Top Description Fields Constructors Methods
liquibase

public Class AbstractExtensibleObject

extends Object
implements ExtensibleObject
Class Inheritance
All Implemented Interfaces
liquibase.ExtensibleObject, java.lang.Cloneable
Known Direct Subclasses
liquibase.logging.core.AbstractLogger, liquibase.plugin.AbstractPlugin, liquibase.resource.AbstractResourceAccessor, liquibase.ui.CompositeUIService, liquibase.ui.ConsoleUIService, liquibase.ui.LoggerUIService
Imports
liquibase.exception.UnexpectedLiquibaseException, liquibase.util.ObjectUtil, .SmartMap, .StringUtil, java.lang.reflect.Field, .Modifier, java.util.*

Convenience class implementing ExtensibleObject. It is usually easiest to extend this class rather than implement all of ExtensibleObject yourself.

Field Summary

Modifier and TypeField and Description
private static final Map<Class<T>, Map<String, Field>>
attributeFieldCache

Cache of fields on this object.

private final SmartMap
attributes

Additional non-standard attributes.

Constructor Summary

AccessConstructor and Description
public
public
AbstractExtensibleObject(Map<String, ?> values)

Creates a new object with the given attributes.

Method Summary

Modifier and TypeMethod and Description
public Object
public String
describe()

Implements liquibase.ExtensibleObject.describe.

Output a full description of this object.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Default implementation counts objects equal if their describe() methods return equal strings.

public <T> T
get(String attribute, Class<T> type)

Implements liquibase.ExtensibleObject.get, liquibase.ExtensibleObject.get.

Return the current value of the given attribute name, converted to the passed type.

public <T> T
get(String attribute, T defaultValue)

Implements liquibase.ExtensibleObject.get.

Works like 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)

private Map<String, Field>
public SortedSet<String>
getAttributes()

Implements liquibase.ExtensibleObject.getAttributes.

Return the names of all the set attributes.

protected Object
getFieldValue(String attribute, Class<T> type)

public ObjectMetaData
getObjectMetaData()

Implements liquibase.ExtensibleObject.getObjectMetaData.

Returns the ObjectMetaData describing this instance.

public List<E>
getValuePath(String attributes, Class<T>
the type to convert the last value in the list to.
lastType
)

Implements liquibase.ExtensibleObject.getValuePath.

Traverses dot-separated attributes in the attributePath and returns a list containing all the intermediate values.

public boolean
has(String key)

Implements liquibase.ExtensibleObject.has.

Return true if the given key is defined.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public ExtensibleObject
set(String attribute, Object value)

Implements liquibase.ExtensibleObject.set.

Sets the value of the given attribute.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

attributeFieldCacheback to summary
private static final Map<Class<T>, Map<String, Field>> attributeFieldCache

Cache of fields on this object. Lazy loaded in getAttributeFields()

attributesback to summary
private final SmartMap attributes

Additional non-standard attributes.

Constructor Detail

AbstractExtensibleObjectback to summary
public AbstractExtensibleObject()
AbstractExtensibleObjectback to summary
public AbstractExtensibleObject(Map<String, ?> values)

Creates a new object with the given attributes.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Implements liquibase.ExtensibleObject.clone.

Doc from liquibase.ExtensibleObject.clone.

Expose Cloneable#clone() as public

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
describeback to summary
public String describe()

Implements liquibase.ExtensibleObject.describe.

Doc from liquibase.ExtensibleObject.describe.

Output a full description of this object. Should include all attributes and values.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Default implementation counts objects equal if their describe() methods return equal strings.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public <T> T get(String attribute, Class<T> type)

Implements liquibase.ExtensibleObject.get, liquibase.ExtensibleObject.get.

Doc from liquibase.ExtensibleObject.get.

Return the current value of the given attribute name, converted to the passed type. If the passed attribute is null or not defined, returns null. If you do not know the type to convert to, pass Object.class as the type. Conversion is done using liquibase.util.ObjectUtil#convert(Object, Class). Should traverse dot-separated attributes.

Annotations
@Override
getback to summary
public <T> T get(String attribute, T defaultValue)

Implements liquibase.ExtensibleObject.get.

Doc from liquibase.ExtensibleObject.get.

Works like 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.

Annotations
@Override
getback to summary
protected <T> T get(String attribute, T defaultValue, Class<T> type)
getAttributeFieldsback to summary
private Map<String, Field> getAttributeFields()
getAttributesback to summary
public SortedSet<String> getAttributes()

Implements liquibase.ExtensibleObject.getAttributes.

Doc from liquibase.ExtensibleObject.getAttributes.

Return the names of all the set attributes. If an attribute is null the name should not be returned. Should return both "standard" attributes and any custom attributes that have been set.

Annotations
@Override
getFieldValueback to summary
protected Object getFieldValue(String attribute, Class<T> type)
getObjectMetaDataback to summary
public ObjectMetaData getObjectMetaData()

Implements liquibase.ExtensibleObject.getObjectMetaData.

Doc from liquibase.ExtensibleObject.getObjectMetaData.

Returns the ObjectMetaData describing this instance.

Annotations
@Override
getValuePathback to summary
public List<E> getValuePath(String attributes, Class<T> lastType)

Implements liquibase.ExtensibleObject.getValuePath.

Doc from liquibase.ExtensibleObject.getValuePath.

Traverses dot-separated attributes in the attributePath and returns a list containing all the intermediate values.

Parameters
lastType:Class<T>

the type to convert the last value in the list to.

Annotations
@Override
hasback to summary
public boolean has(String key)

Implements liquibase.ExtensibleObject.has.

Return true if the given key is defined.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
setback to summary
public ExtensibleObject set(String attribute, Object value)

Implements liquibase.ExtensibleObject.set.

Doc from liquibase.ExtensibleObject.set.

Sets the value of the given attribute. Subclasses can override this method to provide conversion business logic, but must remember that fields can be set directly when no type conversion is needed.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override