Class QueryHelper


  • public abstract class QueryHelper
    extends java.lang.Object
    Static methods to assist with query generation from front end.
    Author:
    Richard Smith
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAndConstraint​(Query q, Constraint constraint)
      Add a constraint to be ANDed with those present in a Query.
      static java.util.List<java.lang.String> getColumnAliases​(Query query)
      Returns a list of aliases, where each alias corresponds to each element of the SELECT list of the Query object.
      static java.util.List<java.lang.Class<?>> getColumnTypes​(Query query)
      Returns a list of Class objects, where each object corresponds to the type of each element of the SELECT list of the Query object.
      • Methods inherited from class java.lang.Object

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

      • addAndConstraint

        public static void addAndConstraint​(Query q,
                                            Constraint constraint)
        Add a constraint to be ANDed with those present in a Query. If the Query currently has no constraints just add the newConstraint. If q.getConstraint() returns a ConstraintSet of type AND, add newConstraint to it. If q.getConstraint() returns something make other than an AND constraint, add new ConstraintSet of type AND that contains both the old and new constraints.
        Parameters:
        q - the query in question
        constraint - the constraint to add
      • getColumnAliases

        public static java.util.List<java.lang.String> getColumnAliases​(Query query)
        Returns a list of aliases, where each alias corresponds to each element of the SELECT list of the Query object. This is effectively a list of column headings for the results object.
        Parameters:
        query - the Query object
        Returns:
        a List of Strings, each of which is the alias of the column
      • getColumnTypes

        public static java.util.List<java.lang.Class<?>> getColumnTypes​(Query query)
        Returns a list of Class objects, where each object corresponds to the type of each element of the SELECT list of the Query object. This is effectively a list of column types for the results object.
        Parameters:
        query - the Query object
        Returns:
        a List of Class objects