Class DbProperty

java.lang.Object
org.alfresco.util.schemacomp.DbProperty

public class DbProperty extends Object
A pointer to a specific DbObject property and its value (at time of creating the DbProperty object).
Author:
Matt Ward
  • Constructor Details

    • DbProperty

      protected DbProperty(DbObject dbObject, String propertyName, int index, boolean useSuppliedValue, Object propertyValue)
      Full constructor allowing control over whether the property name should be indexed (e.g. colours[3]), whether the current value of the property should be retrieved automatically or whether to use the supplied value (useful when performing comparisons - construct one with a particular/expected value and construct another with the current value by reflection).

      The public constructors provide a more usable API with select sets of arguments.

      Parameters:
      dbObject - DbObject
      propertyName - String
      index - int
      useSuppliedValue - boolean
      propertyValue - Object
    • DbProperty

      public DbProperty(DbObject dbObject)
      Construct a pointer to a database object only (no property within).
      Parameters:
      dbObject - DbObject
    • DbProperty

      public DbProperty(DbObject dbObject, String propertyName)
      Create a DbProperty by supplying the DbObject and the property name. The value at time of creation will be populate automatically.
      Parameters:
      dbObject - DbObject
      propertyName - String
    • DbProperty

      public DbProperty(DbObject dbObject, String propertyName, int index)
      Create a DbProperty with an indexed value, e.g. for propertyName "myCollection" and index 4, the propertyName will be converted to "myCollection[4]" and the propertValue will be populated with the value at index 4 of myCollection.
      Parameters:
      dbObject - DbObject
      propertyName - String
      index - int
  • Method Details

    • getDbObject

      public DbObject getDbObject()
      Returns:
      the dbObject
    • getPropertyName

      public String getPropertyName()
      Returns:
      the propertyName
    • getPropertyValue

      public Object getPropertyValue()
      Returns:
      the propertyValue
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getPath

      public String getPath()
      Work backwards from this DbProperty's DbObject to the root object to create a path in the following format:

      root.child.grandchild[...].property

      e.g. myschema.person.age.nullable

      This isn't exactly the same as a FQ database object name, for example the property name could be indexed:

      e.g. myschema.person.pk_person.columnNames[2]

      to reflect the third column name in the primary key named "pk_person" on the person table.

      Returns:
      String path