Class DbProperty


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

      Constructors 
      Modifier Constructor Description
        DbProperty​(DbObject dbObject)
      Construct a pointer to a database object only (no property within).
        DbProperty​(DbObject dbObject, java.lang.String propertyName)
      Create a DbProperty by supplying the DbObject and the property name.
        DbProperty​(DbObject dbObject, java.lang.String propertyName, int index)
      Create a DbProperty with an indexed value, e.g.
      protected DbProperty​(DbObject dbObject, java.lang.String propertyName, int index, boolean useSuppliedValue, java.lang.Object propertyValue)
      Full constructor allowing control over whether the property name should be indexed (e.g.
    • Constructor Detail

      • DbProperty

        protected DbProperty​(DbObject dbObject,
                             java.lang.String propertyName,
                             int index,
                             boolean useSuppliedValue,
                             java.lang.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,
                          java.lang.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,
                          java.lang.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 Detail

      • getDbObject

        public DbObject getDbObject()
        Returns:
        the dbObject
      • getPropertyName

        public java.lang.String getPropertyName()
        Returns:
        the propertyName
      • getPropertyValue

        public java.lang.Object getPropertyValue()
        Returns:
        the propertyValue
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public java.lang.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