public interface AttributedObject
An AttributedObject
is an object that has zero or more attributes associated with it. An attribute
may represent a learned annotation (e.g. part of speech or word sense), metadata (e.g. author or source url), or a
feature (e.g. suffix or phonetic encoding).
Modifier and Type | Method and Description |
---|---|
Set<AttributeType> |
attributes()
Gets the attributes associated with the object
|
Set<Map.Entry<AttributeType,com.davidbracewell.conversion.Val>> |
attributeValues()
Gets the set of attributes and values associated with the object.
|
boolean |
contains(AttributeType attributeType)
Determines if an attribute of a given name is associated with the object
|
com.davidbracewell.conversion.Val |
get(AttributeType attributeType)
Gets the value for a given attribute name
|
default <T> T |
get(AttributeType attributeType,
Class<T> clazz) |
default double |
getAttributeAsDouble(AttributeType attributeType) |
default int |
getAttributeAsInt(AttributeType attributeType) |
default <T> List<T> |
getAttributeAsList(AttributeType attributeType) |
default <K,V> Map<K,V> |
getAttributeAsMap(AttributeType attributeType) |
default <T> Set<T> |
getAttributeAsSet(AttributeType attributeType) |
default String |
getAttributeAsString(AttributeType attributeType) |
default <T extends com.davidbracewell.Tag> |
getAttributeAsTag(AttributeType attributeType) |
com.davidbracewell.conversion.Val |
put(AttributeType attributeType,
Object value)
Sets the value of an attribute.
|
default void |
putAll(Map<AttributeType,?> map)
Sets all attributes in a given map.
|
default com.davidbracewell.conversion.Val |
putIfAbsent(AttributeType attributeType,
Object value)
Sets the value of an attribute if a value is not already set.
|
default com.davidbracewell.conversion.Val |
putIfAbsent(AttributeType attributeType,
Supplier<?> supplier)
Sets the value of an attribute if a value is not already set.
|
com.davidbracewell.conversion.Val |
remove(AttributeType attributeType)
Removes an attribute from the object.
|
Set<Map.Entry<AttributeType,com.davidbracewell.conversion.Val>> attributeValues()
Set<AttributeType> attributes()
boolean contains(AttributeType attributeType)
attributeType
- The attribute namecom.davidbracewell.conversion.Val get(AttributeType attributeType)
attributeType
- the attribute namedefault <T> T get(@NonNull AttributeType attributeType, @NonNull Class<T> clazz)
default int getAttributeAsInt(@NonNull AttributeType attributeType)
default double getAttributeAsDouble(@NonNull AttributeType attributeType)
default String getAttributeAsString(@NonNull AttributeType attributeType)
default <T> List<T> getAttributeAsList(@NonNull AttributeType attributeType)
default <T extends com.davidbracewell.Tag> T getAttributeAsTag(@NonNull AttributeType attributeType)
default <T> Set<T> getAttributeAsSet(@NonNull AttributeType attributeType)
default <K,V> Map<K,V> getAttributeAsMap(@NonNull AttributeType attributeType)
com.davidbracewell.conversion.Val put(AttributeType attributeType, Object value)
attributeType
- the attribute namevalue
- the valuedefault com.davidbracewell.conversion.Val putIfAbsent(AttributeType attributeType, Object value)
attributeType
- the attribute namevalue
- the valuedefault com.davidbracewell.conversion.Val putIfAbsent(AttributeType attributeType, @NonNull Supplier<?> supplier)
attributeType
- the attribute namesupplier
- the supplier to generate the new valuedefault void putAll(Map<AttributeType,?> map)
map
- the attribute-value mapcom.davidbracewell.conversion.Val remove(AttributeType attributeType)
attributeType
- the attribute nameCopyright © 2016. All rights reserved.