Class ItemToolkit

java.lang.Object
org.openjdk.jmc.common.item.ItemToolkit

public class ItemToolkit extends Object
Toolkit methods for performing operations on items.
  • Constructor Details

    • ItemToolkit

      public ItemToolkit()
  • Method Details

    • accessor

      @Deprecated public static <T> IMemberAccessor<T,IItem> accessor(IAttribute<T> a)
      Deprecated.
      This method returns a member accessor that is not thread safe. Instead of creating an accessor that could be used for multiple item types, items should be iterated by type, preferably using an IAggregator which enables parallel processing.
    • asIterable

      @Deprecated public static Iterable<IItem> asIterable(IItemCollection items)
      Deprecated.
    • getItemType

      public static <T extends IItem> IType<T> getItemType(T item)
    • getFirstFound

      public static <T> T getFirstFound(IItemCollection items, IAttribute<T> attribute)
      Returns the value of the event first encountered with the attribute. Note that it is usually a better idea to use Aggregators.AdvancedMinAggregator to truly get the first (time-wise) matching event. This method literally returns the attribute for the first item found when iterating through the IItems, one IItemIterable at a time.

      This method should only be used when you do not care which item you get; any matching is fine. This is commonly the case when looking up relatively static information dumped per chunk, for example environment variables. Also make sure that the collection is properly filtered down to only contain events where the attribute can be applied.

      Type Parameters:
      T - attribute value type
      Parameters:
      items - items to search for attribute value in
      attribute - the attribute to retrieve
      Returns:
      the value of the attribute
      See Also: