com.ibm.commerce.component.bod

Class VerbPath

  • java.lang.Object
    • com.ibm.commerce.component.bod.VerbPath


  • public class VerbPath
    extends java.lang.Object
    A verb path describes a path which a verb follows to update an object or a field. A path is always relative. The root of the path is decided by a VerbPathContext. A path has zero or more steps. Each step represents a graph node, which is a Java object. Please see VerbPathStep for details. s
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASS_NAME
      Name of this class
      static java.lang.String COPYRIGHT
      IBM Copyright
      static java.lang.String PATH_SEPARATOR
      The path separator of a VerbPath
    • Constructor Summary

      Constructors 
      Constructor and Description
      VerbPath(java.util.List stepList) 
      VerbPath(VerbPathStep[] theSteps)
      Constructs a verb path from a list of steps
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addStep(VerbPathStep aStep)
      Appends a given step to the path
      boolean endsWith(VerbPathContext context, java.lang.Object endNode, java.lang.String endAttr)
      Check if a path ends with an attribute of a given object in a given context
      boolean equals(java.lang.Object o) 
      java.lang.String getDescriptor() 
      java.util.List getSteps() 
      java.lang.Object getValue(VerbPathContext context)
      Gets the value designated by this path within the given context.
      boolean hasDescriptor(java.lang.String aDescriptor)
      Check if the path matches the given descriptor
      int hashCode() 
      boolean isEmpty() 
      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
        See Also:
        Constant Field Values
      • PATH_SEPARATOR

        public static final java.lang.String PATH_SEPARATOR
        The path separator of a VerbPath
        See Also:
        Constant Field Values
      • CLASS_NAME

        public static final java.lang.String CLASS_NAME
        Name of this class
    • Constructor Detail

      • VerbPath

        public VerbPath(java.util.List stepList)
        Parameters:
        steps - a List that contains VerbPathStep
      • VerbPath

        public VerbPath(VerbPathStep[] theSteps)
        Constructs a verb path from a list of steps
        Parameters:
        steps - sequence of the steps for this path
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of the path. Empty string if the path is empty
      • isEmpty

        public boolean isEmpty()
        Returns:
        True if the path has no steps. False otherwise.
      • getSteps

        public java.util.List getSteps()
        Returns:
        A read-only list of all the steps
      • addStep

        public void addStep(VerbPathStep aStep)
        Appends a given step to the path
        Parameters:
        aStep - the step to be appended to the path
      • getValue

        public java.lang.Object getValue(VerbPathContext context)
        Gets the value designated by this path within the given context.
        Parameters:
        context - the context in which the path is effective
        Returns:
        Resulting value of the path evaluation. It will return Null if no value is found.
      • getDescriptor

        public java.lang.String getDescriptor()
        Returns:
        A string that describes the path
      • hasDescriptor

        public boolean hasDescriptor(java.lang.String aDescriptor)
        Check if the path matches the given descriptor
        Parameters:
        aDescriptor - A descriptor that describes a path
        Returns:
        true if the path's descriptor is the same as the given one. False otherwise.
      • endsWith

        public boolean endsWith(VerbPathContext context,
                                java.lang.Object endNode,
                                java.lang.String endAttr)
        Check if a path ends with an attribute of a given object in a given context
        Parameters:
        context - the context of the path
        endNode - the last node on a path
        endAttr - the attribute name of the last node
        Returns:
        true if the path starts with startNode and ends with endNode.endAttr, false otherwise.
      • equals

        public boolean equals(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the given object is a verb path, and each step is equal. False otherwise.
      • hashCode

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