Package adql.parser

## Class ADQLQueryFactory

- java.lang.Object
- - adql.parser.ADQLQueryFactory

- Direct Known Subclasses:
    `SQLServer_ADQLQueryFactory`

      public class ADQLQueryFactory
      extends java.lang.Object

  This class lets the `ADQLParser` to build an object representation of an ADQL query.

  To customize the object representation you merely have to extends the appropriate functions of this class.

  Version:
    1.4 (04/2017)
  Author:
    Grégory Mantelet (CDS;ARI)
  See Also:
    `ADQLParser`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `ADQLQueryFactory.JoinType` | Type of table JOIN.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ADQLQueryFactory()` | Create a query factory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `AreaFunction` | `createArea​(GeometryFunction param)` |
    `AreaFunction` | `createArea​(GeometryFunction.GeometryValue<GeometryFunction> param)` |
    `Between` | `createBetween​(boolean not, ADQLOperand value, ADQLOperand min, ADQLOperand max)` |
    `BoxFunction` | `createBox​(ADQLOperand coordinateSystem, ADQLOperand firstCoord, ADQLOperand secondCoord, ADQLOperand boxWidth, ADQLOperand boxHeight)` |
    `CentroidFunction` | `createCentroid​(GeometryFunction param)` |
    `CentroidFunction` | `createCentroid​(GeometryFunction.GeometryValue<GeometryFunction> param)` |
    `CircleFunction` | `createCircle​(ADQLOperand coordSys, ADQLOperand coord1, ADQLOperand coord2, ADQLOperand radius)` |
    `ColumnReference` | `createColRef​(int index, TextPosition position)` |
    `ColumnReference` | `createColRef​(IdentifierItems idItems)` |
    `ColumnReference` | `createColRef​(IdentifierItems.IdentifierItem idItem)` |
    `ADQLColumn` | `createColumn​(IdentifierItems idItems)` |
    `ADQLColumn` | `createColumn​(IdentifierItems.IdentifierItem columnName)` |
    `Comparison` | `createComparison​(ADQLOperand leftOp, ComparisonOperator op, ADQLOperand rightOp)` |
    `Concatenation` | `createConcatenation()` |
    `ContainsFunction` | `createContains​(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right)` |
    `ContainsFunction` | `createContains​(GeometryFunction left, GeometryFunction right)` |
    `ExtractCoord` | `createCoord1​(ADQLColumn point)` |
    `ExtractCoord` | `createCoord1​(PointFunction point)` |
    `ExtractCoord` | `createCoord2​(ADQLColumn point)` |
    `ExtractCoord` | `createCoord2​(PointFunction point)` |
    `DistanceFunction` | `createDistance​(GeometryFunction.GeometryValue<PointFunction> point1, GeometryFunction.GeometryValue<PointFunction> point2)` |
    `DistanceFunction` | `createDistance​(PointFunction point1, PointFunction point2)` |
    `Exists` | `createExists​(ADQLQuery query)` |
    `ExtractCoordSys` | `createExtractCoordSys​(ADQLColumn param)` |
    `ExtractCoordSys` | `createExtractCoordSys​(GeometryFunction param)` |
    `ExtractCoordSys` | `createExtractCoordSys​(GeometryFunction.GeometryValue<GeometryFunction> param)` |
    `ConstraintsGroup` | `createGroupOfConstraints()` |
    `In` | `createIn​(ADQLOperand leftOp, ADQLQuery query, boolean notIn)` |
    `In` | `createIn​(ADQLOperand leftOp, ADQLOperand[] valuesList, boolean notIn)` |
    `IntersectsFunction` | `createIntersects​(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right)` |
    `IntersectsFunction` | `createIntersects​(GeometryFunction left, GeometryFunction right)` |
    `IsNull` | `createIsNull​(boolean notNull, ADQLColumn column)` |
    `ADQLJoin` | `createJoin​(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable)` |
    `ADQLJoin` | `createJoin​(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, ClauseConstraints condition)` |
    `ADQLJoin` | `createJoin​(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, java.util.Collection<ADQLColumn> lstColumns)` |
    `MathFunction` | `createMathFunction​(MathFunctionType type, ADQLOperand param1, ADQLOperand param2)` |
    `NegativeOperand` | `createNegativeOperand​(ADQLOperand opToNegativate)` |
    `NotConstraint` | `createNot​(ADQLConstraint constraintToNot)` |
    `NumericConstant` | `createNumericConstant​(java.lang.String value)` |
    `Operation` | `createOperation​(ADQLOperand leftOp, OperationType op, ADQLOperand rightOp)` |
    `ADQLOrder` | `createOrder​(int ind, boolean desc)` | Replace `createOrder(int, boolean, TextPosition)`.
    `ADQLOrder` | `createOrder​(int ind, boolean desc, TextPosition position)` | Deprecated. since 1.4 ; Replaced by `createOrder(int, boolean)`
    `ADQLOrder` | `createOrder​(IdentifierItems.IdentifierItem colName, boolean desc)` |
    `ADQLOrder` | `createOrder​(IdentifierItems idItems, boolean desc)` | Deprecated. since 1.4 ; Former version's mistake: an ORDER BY item is either a regular/delimited column name or an integer, not a qualified column name ; Replaced by `createOrder(adql.parser.IdentifierItems.IdentifierItem, boolean)` ; This function is no longer used by ADQLParser.
    `PointFunction` | `createPoint​(ADQLOperand coordSys, ADQLOperand coords, ADQLOperand coords2)` |
    `PolygonFunction` | `createPolygon​(ADQLOperand coordSys, java.util.Collection<? extends ADQLOperand> coords)` |
    `ADQLQuery` | `createQuery()` |
    `RegionFunction` | `createRegion​(ADQLOperand param)` |
    `SelectItem` | `createSelectItem​(ADQLOperand operand, java.lang.String alias)` |
    `SQLFunction` | `createSQLFunction​(SQLFunctionType type, ADQLOperand op, boolean distinctValues)` |
    `StringConstant` | `createStringConstant​(java.lang.String value)` |
    `ADQLTable` | `createTable​(IdentifierItems idItems, IdentifierItems.IdentifierItem alias)` |
    `ADQLTable` | `createTable​(ADQLQuery query, IdentifierItems.IdentifierItem alias)` |
    `UserDefinedFunction` | `createUserDefinedFunction​(java.lang.String name, ADQLOperand[] params)` | Creates the user defined functions called as the given name and with the given parameters.
    `WrappedOperand` | `createWrappedOperand​(ADQLOperand opToWrap)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ADQLQueryFactory

          public ADQLQueryFactory()

      Create a query factory.

  - ### Method Detail

    - #### createQuery

          public ADQLQuery createQuery()
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createTable

          public ADQLTable createTable​(IdentifierItems idItems,
                                       IdentifierItems.IdentifierItem alias)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createTable

          public ADQLTable createTable​(ADQLQuery query,
                                       IdentifierItems.IdentifierItem alias)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createJoin

          public ADQLJoin createJoin​(ADQLQueryFactory.JoinType type,
                                     FromContent leftTable,
                                     FromContent rightTable)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createJoin

          public ADQLJoin createJoin​(ADQLQueryFactory.JoinType type,
                                     FromContent leftTable,
                                     FromContent rightTable,
                                     ClauseConstraints condition)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createJoin

          public ADQLJoin createJoin​(ADQLQueryFactory.JoinType type,
                                     FromContent leftTable,
                                     FromContent rightTable,
                                     java.util.Collection<ADQLColumn> lstColumns)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createSelectItem

          public SelectItem createSelectItem​(ADQLOperand operand,
                                             java.lang.String alias)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createColumn

          public ADQLColumn createColumn​(IdentifierItems idItems)
                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createColumn

          public ADQLColumn createColumn​(IdentifierItems.IdentifierItem columnName)
                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createNumericConstant

          public NumericConstant createNumericConstant​(java.lang.String value)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createStringConstant

          public StringConstant createStringConstant​(java.lang.String value)
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createOperation

          public Operation createOperation​(ADQLOperand leftOp,
                                           OperationType op,
                                           ADQLOperand rightOp)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createNegativeOperand

          public NegativeOperand createNegativeOperand​(ADQLOperand opToNegativate)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createConcatenation

          public Concatenation createConcatenation()
                                            throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createWrappedOperand

          public WrappedOperand createWrappedOperand​(ADQLOperand opToWrap)
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createGroupOfConstraints

          public ConstraintsGroup createGroupOfConstraints()
                                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createNot

          public NotConstraint createNot​(ADQLConstraint constraintToNot)
                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createComparison

          public Comparison createComparison​(ADQLOperand leftOp,
                                             ComparisonOperator op,
                                             ADQLOperand rightOp)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createBetween

          public Between createBetween​(boolean not,
                                       ADQLOperand value,
                                       ADQLOperand min,
                                       ADQLOperand max)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createIsNull

          public IsNull createIsNull​(boolean notNull,
                                     ADQLColumn column)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createExists

          public Exists createExists​(ADQLQuery query)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createIn

          public In createIn​(ADQLOperand leftOp,
                             ADQLQuery query,
                             boolean notIn)
                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createIn

          public In createIn​(ADQLOperand leftOp,
                             ADQLOperand[] valuesList,
                             boolean notIn)
                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createSQLFunction

          public SQLFunction createSQLFunction​(SQLFunctionType type,
                                               ADQLOperand op,
                                               boolean distinctValues)
                                        throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createMathFunction

          public MathFunction createMathFunction​(MathFunctionType type,
                                                 ADQLOperand param1,
                                                 ADQLOperand param2)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createUserDefinedFunction

          public UserDefinedFunction createUserDefinedFunction​(java.lang.String name,
                                                               ADQLOperand[] params)
                                                        throws java.lang.Exception

      Creates the user defined functions called as the given name and with the given parameters.

      By default, this function returns a `DefaultUDF` instance. It is generic enough to cover every kind of functions. But you can of course override this function in order to return your own instance of `UserDefinedFunction`. In this case, you may not forget to call the super function (super.createUserDefinedFunction(name, params)) so that all other unknown functions are still returned as `DefaultUDF` instances.

      IMPORTANT: The tests done to check whether a user defined function is allowed/managed in this implementation, is done later by the parser. Only declared UDF will pass the test of the parser. For that, you should give it a list of allowed UDFs (each UDF will be then represented by a `FunctionDef` object).

      Parameters:
        `name` - Name of the user defined function to create.
        `params` - Parameters of the user defined function to create.
      Returns:
        The corresponding user defined function (by default an instance of `DefaultUDF`).
      Throws:
        `java.lang.Exception` - If there is a problem while creating the function.

    - #### createDistance

          public DistanceFunction createDistance​(PointFunction point1,
                                                 PointFunction point2)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createDistance

          public DistanceFunction createDistance​(GeometryFunction.GeometryValue<PointFunction> point1,
                                                 GeometryFunction.GeometryValue<PointFunction> point2)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createPoint

          public PointFunction createPoint​(ADQLOperand coordSys,
                                           ADQLOperand coords,
                                           ADQLOperand coords2)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createBox

          public BoxFunction createBox​(ADQLOperand coordinateSystem,
                                       ADQLOperand firstCoord,
                                       ADQLOperand secondCoord,
                                       ADQLOperand boxWidth,
                                       ADQLOperand boxHeight)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCircle

          public CircleFunction createCircle​(ADQLOperand coordSys,
                                             ADQLOperand coord1,
                                             ADQLOperand coord2,
                                             ADQLOperand radius)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCentroid

          public CentroidFunction createCentroid​(GeometryFunction param)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCentroid

          public CentroidFunction createCentroid​(GeometryFunction.GeometryValue<GeometryFunction> param)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createRegion

          public RegionFunction createRegion​(ADQLOperand param)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createPolygon

          public PolygonFunction createPolygon​(ADQLOperand coordSys,
                                               java.util.Collection<? extends ADQLOperand> coords)
                                        throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createArea

          public AreaFunction createArea​(GeometryFunction param)
                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createArea

          public AreaFunction createArea​(GeometryFunction.GeometryValue<GeometryFunction> param)
                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCoord1

          public ExtractCoord createCoord1​(PointFunction point)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCoord1

          public ExtractCoord createCoord1​(ADQLColumn point)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCoord2

          public ExtractCoord createCoord2​(PointFunction point)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createCoord2

          public ExtractCoord createCoord2​(ADQLColumn point)
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createExtractCoordSys

          public ExtractCoordSys createExtractCoordSys​(GeometryFunction param)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createExtractCoordSys

          public ExtractCoordSys createExtractCoordSys​(ADQLColumn param)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createExtractCoordSys

          public ExtractCoordSys createExtractCoordSys​(GeometryFunction.GeometryValue<GeometryFunction> param)
                                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createContains

          public ContainsFunction createContains​(GeometryFunction left,
                                                 GeometryFunction right)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createContains

          public ContainsFunction createContains​(GeometryFunction.GeometryValue<GeometryFunction> left,
                                                 GeometryFunction.GeometryValue<GeometryFunction> right)
                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createIntersects

          public IntersectsFunction createIntersects​(GeometryFunction left,
                                                     GeometryFunction right)
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createIntersects

          public IntersectsFunction createIntersects​(GeometryFunction.GeometryValue<GeometryFunction> left,
                                                     GeometryFunction.GeometryValue<GeometryFunction> right)
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createOrder

          public ADQLOrder createOrder​(int ind,
                                       boolean desc)
                                throws java.lang.Exception

      Replace `createOrder(int, boolean, TextPosition)`.
      Throws:
        `java.lang.Exception`
      Since:
        1.4

    - #### createOrder

          @Deprecated
          public ADQLOrder createOrder​(int ind,
                                       boolean desc,
                                       TextPosition position)
                                throws java.lang.Exception

      Deprecated.
      since 1.4 ; Replaced by `createOrder(int, boolean)`
      Throws:
        `java.lang.Exception`

    - #### createOrder

          public ADQLOrder createOrder​(IdentifierItems.IdentifierItem colName,
                                       boolean desc)
                                throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createOrder

          @Deprecated
          public ADQLOrder createOrder​(IdentifierItems idItems,
                                       boolean desc)
                                throws java.lang.Exception

      Deprecated.
      since 1.4 ; Former version's mistake: an ORDER BY item is either a regular/delimited column name or an integer, not a qualified column name ; Replaced by `createOrder(adql.parser.IdentifierItems.IdentifierItem, boolean)` ; This function is no longer used by ADQLParser.
      Throws:
        `java.lang.Exception`

    - #### createColRef

          public ColumnReference createColRef​(IdentifierItems.IdentifierItem idItem)
                                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createColRef

          public ColumnReference createColRef​(IdentifierItems idItems)
                                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### createColRef

          public ColumnReference createColRef​(int index,
                                              TextPosition position)
                                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`