com.ibm.commerce.giftregistry.service.valueobjects

Class BaseVO

  • java.lang.Object
    • com.ibm.commerce.giftregistry.service.valueobjects.BaseVO
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASS_NAME
      Class name
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      static java.lang.String VALUE_OBJECT_ID
      The name of the attribute that can be used to uniquely identify a value object
    • Constructor Summary

      Constructors 
      Constructor and Description
      BaseVO()
      Default constructor
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object o)
      Evaluates if a given object is equal to this one.
      java.lang.Object get(java.lang.String name)
      Gets the value of field by name
      ValueObjectContext getContext() 
      java.util.Map getDataMap() 
      java.lang.String getDescriptor(java.lang.String field)
      Calculates the path descriptor of the value object.
      abstract java.lang.Object getId() 
      java.lang.String getObjectKey() 
      int hashCode() 
      boolean isEmpty() 
      boolean isNew()
      Checks if a value object is newly created.
      void set(java.lang.String name, java.lang.Object value)
      Sets the value of a designated field.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CLASS_NAME

        public static final java.lang.String CLASS_NAME
        Class name
      • VALUE_OBJECT_ID

        public static final java.lang.String VALUE_OBJECT_ID
        The name of the attribute that can be used to uniquely identify a value object
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseVO

        public BaseVO()
        Default constructor
    • Method Detail

      • getContext

        public final ValueObjectContext getContext()
        Returns:
        the context of the value object
      • get

        public final java.lang.Object get(java.lang.String name)
        Gets the value of field by name
        Parameters:
        name - the name that designates a field
        Returns:
        the value of the designated field
      • set

        public final void set(java.lang.String name,
                              java.lang.Object value)
        Sets the value of a designated field. If the value is a BaseVO, a Set of BaseVO, a List of BaseVO, or an array of BaseVO, the context(s) of or in the given value will be set. Otherwise, it's the caller's responsibility to make sure any BaseVO contained in the given value is set.
        Parameters:
        name - the name that designates a field
        value - the value of the designated field
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if the value object contains nothing, false otherwise.
      • getDataMap

        public java.util.Map getDataMap()
        Returns:
        a Map that contains all the data of the value object. This map is read-only.
      • getId

        public abstract java.lang.Object getId()
        Returns:
        the identifier that uniquely identifies a value object after the value object has been persisted.
      • getDescriptor

        public final java.lang.String getDescriptor(java.lang.String field)
        Calculates the path descriptor of the value object.
        Parameters:
        field - the field of the value object
        Returns:
        the path descriptor of the value object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation of this object
      • isNew

        public boolean isNew()
        Checks if a value object is newly created. The default rule is that a value object is new if and only its ID has been set. If the ID is represented by a String, it can't be an empty string.
        Returns:
        true if a value object is newly created. False otherwise.
      • getObjectKey

        public final java.lang.String getObjectKey()
        Returns:
        A key that uniquely identifies this value object. The key is created once the value object is instantiated. This key is also universally unique.
      • equals

        public final boolean equals(java.lang.Object o)
        Evaluates if a given object is equal to this one.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to be compared with
        Returns:
        true if the given object is of type BaseVO and has the same object key as this value object. False otherwise.
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()