Class GeometryParser<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>
Direct Known Subclasses:
ST_FromBinary, ST_FromText

abstract class GeometryParser<R,G> extends GeometryConstructor<R,G>
SQLMM spatial functions taking non-geometry operands and parsing a geometry. Geometries can be created from Well-Known Text (WKT), Well-Known Binary (WKB) or Geographic Markup Language (GML).
Since:
1.1
Version:
1.1
  • Field Details

    • serialVersionUID

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

    • GeometryParser

      GeometryParser(SQLMM operation, Expression<? super R,?>[] parameters, Geometries<G> library)
      Creates a new function for the given parameters.
  • Method Details

    • recreate

      public abstract 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.
      Specified by:
      recreate in interface Optimization.OnExpression<R,G>
      Overrides:
      recreate in class GeometryConstructor<R,G>
      Parameters:
      effective - the expressions to use as a replacement of this expression parameters.
      Returns:
      the new expression, or this if unsupported.
    • getSyntax

      public final String getSyntax()
      Returns a Backus-Naur Form (BNF) of this function.
      Overrides:
      getSyntax in class SpatialFunction<R>
    • inputName

      abstract String inputName()
      Returns the name of the kind of input expected by this expression.
      Returns:
      "text" or "wkb".
    • apply

      public final Object apply(R input)
      Creates a geometry from the content of the given object.
      Specified by:
      apply in interface Expression<R,G>
      Specified by:
      apply in interface Function<R,G>
      Overrides:
      apply in class GeometryConstructor<R,G>
      Parameters:
      input - the object to be evaluated by the expression.
      Returns:
      geometry created by the expression, or null if the operation failed..
    • parse

      protected abstract GeometryWrapper<G> parse(Object value) throws Exception
      Parses the given value.
      Parameters:
      value - the WKT, WKB or GML value.
      Returns:
      the geometry parsed from the given value.
      Throws:
      ClassCastException - if the given value is not an instance of the type expected by this operation
      Exception - if parsing failed for another reason. This is an implementation-specific exception.