public class AbstractExtensibleObject extends Object implements ExtensibleObject
Constructor and Description |
---|
AbstractExtensibleObject() |
AbstractExtensibleObject(Map<String,?> values)
Creates a new object with the given attributes.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Expose
Cloneable#clone() as public |
String |
describe()
Output a full description of this object.
|
boolean |
equals(Object obj)
Default implementation counts objects equal if their describe() methods return equal strings.
|
<T> T |
get(String attribute,
Class<T> type)
Return the current value of the given attribute name, converted to the passed type.
|
<T> T |
get(String attribute,
T defaultValue)
Works like
ExtensibleObject.get(String, Class) but if the attribute is null or not defined, returns the passed defaultValue. |
protected <T> T |
get(String attribute,
T defaultValue,
Class<T> type) |
SortedSet<String> |
getAttributes()
Return the names of all the set attributes.
|
protected Object |
getFieldValue(String attribute,
Class type) |
ObjectMetaData |
getObjectMetaData()
Returns the
ObjectMetaData describing this instance. |
List |
getValuePath(String attributes,
Class lastType)
Traverses dot-separated attributes in the attributePath and returns a list containing all the intermediate values.
|
boolean |
has(String key)
Return true if the given key is defined.
|
int |
hashCode() |
ExtensibleObject |
set(String attribute,
Object value)
Sets the value of the given attribute.
|
String |
toString() |
public SortedSet<String> getAttributes()
ExtensibleObject
getAttributes
in interface ExtensibleObject
public ObjectMetaData getObjectMetaData()
ExtensibleObject
ObjectMetaData
describing this instance.getObjectMetaData
in interface ExtensibleObject
public boolean has(String key)
has
in interface ExtensibleObject
public <T> T get(String attribute, Class<T> type)
ExtensibleObject
ObjectUtil.convert(Object, Class)
.
Should traverse dot-separated attributes.get
in interface ExtensibleObject
public <T> T get(String attribute, T defaultValue)
ExtensibleObject
ExtensibleObject.get(String, Class)
but if the attribute is null or not defined, returns the passed defaultValue.
Uses the type of defaultValue to determine the type to convert the current value to.
If null is passed to the default value, no conversion of attribute is made if it is set.
If traversing a dot-separated attribute path, return the default value if any along the path are null.get
in interface ExtensibleObject
public List getValuePath(String attributes, Class lastType)
ExtensibleObject
getValuePath
in interface ExtensibleObject
lastType
- the type to convert the last value in the list to.public ExtensibleObject set(String attribute, Object value)
ExtensibleObject
set
in interface ExtensibleObject
public String describe()
ExtensibleObject
describe
in interface ExtensibleObject
public boolean equals(Object obj)
public Object clone()
ExtensibleObject
Cloneable#clone()
as publicclone
in interface ExtensibleObject
clone
in class Object
Copyright © 2023 Liquibase.org. All rights reserved.