Class EntityAttribute

java.lang.Object
com.loop54.model.EntityAttribute

public class EntityAttribute extends Object
Represents an attribute on an entity in the loop54 search engine. This could for instance be "Price", "Name" or "Category" values that belong to an entity.
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns:
      Name of the attribute. For instance "Price", "Name" or "Category".
    • getType

      public EntityAttributeType getType()
    • getValue

      public <T> T getValue(Class<T> clazz)
      Casts the first value to the specified generic type and returns it, or null if there are no values.
      Type Parameters:
      T - The expected type of the value in the attribute.
      Parameters:
      clazz - Type of the attribute. This needs to match what the library has deserialized or an exception will be thrown.
      Returns:
      The first (or only) value or null if empty.
    • getValues

      public <T> List<T> getValues(Class<T> clazz)
      Casts the values to the specified generic type and return them all as a list.
      Type Parameters:
      T - The expected type of the values in the attribute.
      Parameters:
      clazz - Type of the attribute. This needs to match what the library has deserialized or an exception will be thrown.
      Returns:
      All values with the desired type as a list.