public class Entity
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
id
The unique id of the entity.
|
java.lang.String |
type
The type of the entity.
|
Constructor and Description |
---|
Entity(java.lang.String type,
java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
java.util.List<EntityAttribute> |
getAttributes()
All attributes available on the entity.
|
<T> T |
getAttributeValueOrNull(java.lang.String name,
java.lang.Class<T> clazz)
Gets the attribute value with the desired name and type.
|
<T> java.util.List<T> |
getAttributeValuesOrNull(java.lang.String name,
java.lang.Class<T> clazz)
Gets the attribute values with the desired name and type.
|
void |
setAttributes(java.util.List<EntityAttribute> attributes)
See
getAttributes() . |
public java.lang.String type
public java.lang.String id
public Entity(java.lang.String type, java.lang.String id)
type
- The type of the entity. This is usually "Product".id
- The unique id of the entity. Could for instance be a SKU id.public java.util.List<EntityAttribute> getAttributes()
public void setAttributes(java.util.List<EntityAttribute> attributes)
getAttributes()
.attributes
- A list of attributes to set on the entitypublic <T> T getAttributeValueOrNull(java.lang.String name, java.lang.Class<T> clazz)
T
- The expected type of the value in the attribute.name
- Name of the attribute.clazz
- Type of the attribute. This needs to match what the library has deserialized or an exception will be thrown.public <T> java.util.List<T> getAttributeValuesOrNull(java.lang.String name, java.lang.Class<T> clazz)
T
- The expected type of the value in the attribute.name
- Name of the attribute.clazz
- Type of the attribute. This needs to match what the library has deserialized or an exception will be thrown.