Class ST_Point<R,G>

Type Parameters:
R - the type of resources (e.g. Feature) used as inputs.
G - the implementation type of geometry objects.
All Implemented Interfaces:
Serializable, Function<R,Object>, Expression<R,Object>, Optimization.OnExpression<R,Object>, FeatureExpression<R,Object>

final class ST_Point<R,G> extends FunctionWithSRID<R>
An expression which creates a point geometry from coordinate values. In current implementation, the parameters can be:
  • WKT|WKB
  • WKT|WKB, CoordinateReferenceSystem
  • X, Y
  • X, Y, CoordinateReferenceSystem
  • X, Y, Z
  • X, Y, Z, CoordinateReferenceSystem
Since:
1.1
Version:
1.1
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • parameters

      private final Expression<? super R,?>[] parameters
      The expression giving the coordinate values. May include the SRID as last parameter.
    • library

      private final Geometries<G> library
      The library to use for creating geometry objects.
  • Constructor Details

    • ST_Point

      ST_Point(Expression<? super R,?>[] parameters, Geometries<G> library)
      Creates a new function with the given parameters. It is caller's responsibility to ensure that the given array is non-null, has been cloned and does not contain null elements.
      Throws:
      IllegalArgumentException - if the number of arguments is less then two.
  • Method Details

    • recreate

      public Expression<R,Object> recreate(Expression<? super R,?>[] effective)
      Creates a new expression of the same type than this expression, but with an optimized geometry. The optimization may be a geometry computed immediately if all operator parameters are literals.
      Parameters:
      effective - the expressions to use as a replacement of this expression parameters.
      Returns:
      the new expression, or this if unsupported.
    • getGeometryLibrary

      final Geometries<?> getGeometryLibrary()
      Returns a handler for the library of geometric objects used by this expression.
      Specified by:
      getGeometryLibrary in class SpatialFunction<R>
      Returns:
      the geometry library (never null).
      See Also:
    • getParameters

      public List<Expression<? super R,?>> getParameters()
      Returns the sub-expressions that will be evaluated to provide the parameters to the function.
      Returns:
      the sub-expressions to be evaluated, or an empty list if none.
    • value

      private double value(R input, int index, String name)
      Returns the numerical value evaluated by the expression at the given index. If the value is null, then Double.NaN is returned. If the value is not a number, then an IllegalArgumentException is thrown.
      Parameters:
      input - the object to be evaluated by the expression. Can be null.
      index - the parameter index.
      name - parameter name to report in exception message if the value is not a number.
      Returns:
      the numerical value, or Double.NaN if the value was null.
      Throws:
      IllegalArgumentException - if the value is not a number.
    • parse

      private GeometryWrapper<G> parse(Object value) throws Exception
      Parses a WKT or WKB as a point. The result should be a point. While this class could accept to return any kind of geometry, we nevertheless throw an exception if the result is not a point.
      Parameters:
      value - the WKB or WKT value to parse. Can be null.
      Returns:
      the parsed point, or null if the given value is null.
      Throws:
      IllegalArgumentException - if the value is not a string or byte array.
      Exception - if parsing failed for another reason.
    • apply

      public Object apply(R input)
      Creates a point based on the content of the given object. This method returns null if all coordinates are Double.NaN.
      Parameters:
      input - the object to be evaluated by the expression.
      Returns:
      point created by the expression, or null if all coordinates are NaN.