Class GetColumn

  • All Implemented Interfaces:
    java.io.Serializable, JDBCFilterListener, FilterListener

    public class GetColumn
    extends java.lang.Object
    implements JDBCFilterListener
    Returns the SQL alias of the named column for use in a query. Note that to retrieve columns in the table of the candidate object, you must explicitly qualify the extension with this, as demonstrated in the second example below. Examples:
    "company.address.ext:getColumn (\"ID\") == 5"
    "this.ext:getColumn (\"CLS\") == \"org.apache.openjpa.example.Person\""
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TAG  
    • Constructor Summary

      Constructors 
      Constructor Description
      GetColumn()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendTo​(SQLBuffer buf, FilterValue target, FilterValue[] args, ClassMapping type, JDBCStore store)
      Append the SQL for this expression or value.
      java.lang.Object evaluate​(java.lang.Object target, java.lang.Class targetClass, java.lang.Object[] args, java.lang.Class[] argClasses, java.lang.Object candidate, StoreContext ctx)
      Evaluate the given expression.
      boolean expectsArguments()
      Return true if this extension expects arguments to act on.
      boolean expectsTarget()
      Return true if this extension expects a target to act on.
      java.lang.String getTag()
      Return the tag that this extension listens for.
      java.lang.Class getType​(java.lang.Class targetClass, java.lang.Class[] argClasses)
      Return the expected type of the result of this listener.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GetColumn

        public GetColumn()
    • Method Detail

      • getTag

        public java.lang.String getTag()
        Description copied from interface: FilterListener
        Return the tag that this extension listens for.
        Specified by:
        getTag in interface FilterListener
      • expectsArguments

        public boolean expectsArguments()
        Description copied from interface: FilterListener
        Return true if this extension expects arguments to act on. Some extensions may not need arguments; for example, an extension to switch a string to upper case might be of the form: field.ext:toUpperCase ().
        Specified by:
        expectsArguments in interface FilterListener
      • expectsTarget

        public boolean expectsTarget()
        Description copied from interface: FilterListener
        Return true if this extension expects a target to act on. Some extensions act on a field or object value; others stand alone. field.ext:toUpperCase () acts on the target field but has no arguments, while another possible form, ext:toUpperCase (field) has no target but does have an argument.
        Specified by:
        expectsTarget in interface FilterListener
      • evaluate

        public java.lang.Object evaluate​(java.lang.Object target,
                                         java.lang.Class targetClass,
                                         java.lang.Object[] args,
                                         java.lang.Class[] argClasses,
                                         java.lang.Object candidate,
                                         StoreContext ctx)
        Description copied from interface: FilterListener
        Evaluate the given expression. This method is used when evaluating in-memory expressions. The method used when evaluating data store expressions will change depending on the data store in use.
        Specified by:
        evaluate in interface FilterListener
        Parameters:
        target - the target object / field value to act on; will be null if this extension does not expect a target
        targetClass - the expected class of the target; given in case the target evaluates to null and typing is needed
        args - the values of the arguments given in the filter; will be null if this extension does not expect an argument
        argClasses - the expected classes of the arguments; given in case an argument evaluates to null and typing is needed
        candidate - the candidate object being evaluated
        ctx - the persistence context
        Returns:
        the value of the extension for this candidate; if this extension is an expression, this method should return Boolean.TRUE or Boolean.FALSE
      • appendTo

        public void appendTo​(SQLBuffer buf,
                             FilterValue target,
                             FilterValue[] args,
                             ClassMapping type,
                             JDBCStore store)
        Description copied from interface: JDBCFilterListener
        Append the SQL for this expression or value.
        Specified by:
        appendTo in interface JDBCFilterListener
        Parameters:
        buf - the SQL buffer to append to
        target - the target to act on, or null if the listener doesn't expect a target
        args - the values of the arguments given in the filter, or null if this listener doesn't expect arguments
        type - the class mapping for the query's candidate class
        store - the store that owns the query
      • getType

        public java.lang.Class getType​(java.lang.Class targetClass,
                                       java.lang.Class[] argClasses)
        Description copied from interface: FilterListener
        Return the expected type of the result of this listener.
        Specified by:
        getType in interface FilterListener
        Parameters:
        targetClass - the expected class of the target, or null if no target
        argClasses - the expected classes of the arguments, or null if no arguments