Class ModelPropertyPointer

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparable, org.apache.commons.jxpath.Pointer

    public class ModelPropertyPointer
    extends org.apache.commons.jxpath.ri.model.beans.PropertyPointer
    Pointer pointing to a property or field of a JavaBean.
    Version:
    $Id: $
    Author:
    Dmitri Plotnikov, Thomas Fox
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.apache.commons.jxpath.ri.model.beans.PropertyPointer

        bean, propertyIndex, UNSPECIFIED_PROPERTY
      • Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer

        index, locale, parent, UNKNOWN_NAMESPACE, WHOLE_COLLECTION
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelPropertyPointer​(org.apache.commons.jxpath.ri.model.NodePointer parent, org.apache.commons.jxpath.JXPathBeanInfo beanInfo, Class<?> valueClass)
      Create a new BeanPropertyPointer.
    • Method Summary

      Modifier and Type Method Description
      org.apache.commons.jxpath.ri.model.NodePointer createPath​(org.apache.commons.jxpath.JXPathContext context)  
      Object getBaseValue()
      Get the value of the currently selected property.
      Object getImmediateNode()
      If index == WHOLE_COLLECTION, the value of the property, otherwise the value of the index'th element of the collection represented by the property.
      int getLength()
      If the property contains a collection, then the length of that collection, otherwise - 1.
      int getPropertyCount()  
      protected PropertyDescriptor[] getPropertyDescriptors()
      Get all PropertyDescriptors.
      String getPropertyName()
      Get the name of the currently selected property.
      String[] getPropertyNames()
      Get the names of all properties, sorted alphabetically.
      protected boolean isActualProperty()  
      boolean isCollection()  
      boolean isContainer()
      This type of node is auxiliary.
      void remove()  
      void setIndex​(int index)  
      void setPropertyIndex​(int index)
      Selects a property by its offset in the alphabetically sorted list.
      void setPropertyName​(String name)
      Select a property by name.
      void setValue​(Object value)
      If index == WHOLE_COLLECTION, change the value of the property, otherwise change the value of the index'th element of the collection represented by the property.
      • Methods inherited from class org.apache.commons.jxpath.ri.model.beans.PropertyPointer

        compareChildNodePointers, createChild, createChild, createPath, equals, getBean, getImmediateValuePointer, getName, getPropertyIndex, hashCode, isActual, isLeaf
      • Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer

        asPath, attributeIterator, childIterator, clone, compareTo, createAttribute, escape, getAbstractFactory, getDefaultNamespaceURI, getImmediateParentPointer, getIndex, getLocale, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeSetByKey, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValue, getValuePointer, isAttribute, isDefaultNamespace, isLanguage, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, setAttribute, setNamespaceResolver, testNode, toString
    • Constructor Detail

      • ModelPropertyPointer

        public ModelPropertyPointer​(org.apache.commons.jxpath.ri.model.NodePointer parent,
                                    org.apache.commons.jxpath.JXPathBeanInfo beanInfo,
                                    Class<?> valueClass)
        Create a new BeanPropertyPointer.
        Parameters:
        parent - parent pointer
        beanInfo - describes the target property/ies.
        valueClass - the class of the base object
    • Method Detail

      • isContainer

        public boolean isContainer()
        This type of node is auxiliary.
        Overrides:
        isContainer in class org.apache.commons.jxpath.ri.model.NodePointer
        Returns:
        true
      • getPropertyCount

        public int getPropertyCount()
        Specified by:
        getPropertyCount in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
      • getPropertyNames

        public String[] getPropertyNames()
        Get the names of all properties, sorted alphabetically.
        Specified by:
        getPropertyNames in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Returns:
        the names of all properties, not null.
      • setPropertyName

        public void setPropertyName​(String name)
        Select a property by name.
        Specified by:
        setPropertyName in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Parameters:
        name - String name
      • setPropertyIndex

        public void setPropertyIndex​(int index)
        Selects a property by its offset in the alphabetically sorted list.
        Overrides:
        setPropertyIndex in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Parameters:
        index - property index
      • getBaseValue

        public Object getBaseValue()
        Get the value of the currently selected property.
        Specified by:
        getBaseValue in class org.apache.commons.jxpath.ri.model.NodePointer
        Returns:
        Object value
      • setIndex

        public void setIndex​(int index)
        Overrides:
        setIndex in class org.apache.commons.jxpath.ri.model.NodePointer
      • getImmediateNode

        public Object getImmediateNode()
        If index == WHOLE_COLLECTION, the value of the property, otherwise the value of the index'th element of the collection represented by the property. If the property is not a collection, index should be zero and the value will be the property itself.
        Overrides:
        getImmediateNode in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Returns:
        Object
      • isActualProperty

        protected boolean isActualProperty()
        Specified by:
        isActualProperty in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
      • isCollection

        public boolean isCollection()
        Overrides:
        isCollection in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
      • getLength

        public int getLength()
        If the property contains a collection, then the length of that collection, otherwise - 1.
        Overrides:
        getLength in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Returns:
        int length
      • setValue

        public void setValue​(Object value)
        If index == WHOLE_COLLECTION, change the value of the property, otherwise change the value of the index'th element of the collection represented by the property.
        Specified by:
        setValue in interface org.apache.commons.jxpath.Pointer
        Specified by:
        setValue in class org.apache.commons.jxpath.ri.model.NodePointer
        Parameters:
        value - value to set
      • createPath

        public org.apache.commons.jxpath.ri.model.NodePointer createPath​(org.apache.commons.jxpath.JXPathContext context)
        Overrides:
        createPath in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
      • remove

        public void remove()
        Overrides:
        remove in class org.apache.commons.jxpath.ri.model.NodePointer
      • getPropertyName

        public String getPropertyName()
        Get the name of the currently selected property.
        Specified by:
        getPropertyName in class org.apache.commons.jxpath.ri.model.beans.PropertyPointer
        Returns:
        String property name
      • getPropertyDescriptors

        protected PropertyDescriptor[] getPropertyDescriptors()
        Get all PropertyDescriptors.
        Returns:
        PropertyDescriptor[]