T
- Attribute type.public class AttributeEvent<T> extends AbstractIdentifiable
AttributeListener
. This is a unique event that contains the
relevant AttributeType
value and it's parent AttributeContainer
(even if the
Attribute has been removed). When an attribute is replaced the previous attribute is also
contained within the event.AttributeContainer
id
Constructor and Description |
---|
AttributeEvent(AttributeContainer container,
NamedAttributeType<T> namedType,
T value)
Creates a new AttributeEvent with a random ID (with no previous Attribute).
|
AttributeEvent(AttributeContainer container,
NamedAttributeType<T> namedType,
T value,
T replacedValue)
Creates a new AttributeEvent with a random ID.
|
Modifier and Type | Method and Description |
---|---|
AttributeContainer |
getContainer()
Gets the Attribute's parent container.
|
java.lang.String |
getName()
Gets the attribute name.
|
NamedAttributeType<T> |
getNamedType()
Gets the named attribute type.
|
java.util.Optional<T> |
getOptReplacedValue()
Get the Attribute that was replaced by this Attribute.
|
T |
getReplacedValue()
Get the Attribute that was replaced by this Attribute.
|
AttributeType<T> |
getType()
Gets the attribute type for the attribute.
|
T |
getValue()
Gets the Attribute the event is for.
|
boolean |
isReplacement()
Checks whether the previous Attribute was replaced by this Attribute.
|
equals, getID, hashCode, toString
public AttributeEvent(AttributeContainer container, NamedAttributeType<T> namedType, T value)
container
- Parent container for the Attribute.namedType
- Named attribute type.value
- Attribute the event is for.public AttributeEvent(AttributeContainer container, NamedAttributeType<T> namedType, T value, T replacedValue)
container
- Parent container for the Attribute.namedType
- Named attribute type.value
- Attribute the event is for.replacedValue
- The previous attribute that has been replaced by this Attribute (can be null).public AttributeContainer getContainer()
public java.lang.String getName()
public NamedAttributeType<T> getNamedType()
public java.util.Optional<T> getOptReplacedValue()
public T getReplacedValue()
public AttributeType<T> getType()
public T getValue()
public boolean isReplacement()