Class PropertyValue.Converted<V>

Type Parameters:
V - the type of value computed by the expression.
All Implemented Interfaces:
Serializable, Function<AbstractFeature,V>, Expression<AbstractFeature,V>, Optimization.OnExpression<AbstractFeature,V>, FeatureExpression<AbstractFeature,V>, ValueReference<AbstractFeature,V>
Direct Known Subclasses:
PropertyValue.CastedAndConverted
Enclosing class:
PropertyValue<V>

private static class PropertyValue.Converted<V> extends PropertyValue<V>
An expression fetching property values as an object of specified type. The value is converted from Object to the specified type.
  • Field Details

    • serialVersionUID

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

      protected final Class<V> type
      The desired type of values.
  • Constructor Details

    • Converted

      protected Converted(Class<V> type, String xpath, boolean isVirtual)
      Creates a new expression retrieving values from a property of the given name.
      Parameters:
      type - the desired type for the expression result.
      name - the name of the property to fetch.
  • Method Details

    • getValueClass

      public final Class<V> getValueClass()
      Returns the type of values computed by this expression.
      Returns:
      the type of values computed by this expression.
    • apply

      public V apply(AbstractFeature instance)
      Returns the value of the property of the given name. If no value is found for the given feature, then this method returns null.
      Parameters:
      instance - the object to be evaluated by the expression. Can be null if this expression allows null values.
      Returns:
      value computed by the expression.
    • optimize

      public final PropertyValue<V> optimize(Optimization optimization)
      Tries to optimize this expression. If an ObjectConverter can be determined in advance for the feature type for which to optimize, then a specialized expression is returned. Otherwise this method returns this.
      Specified by:
      optimize in interface Optimization.OnExpression<AbstractFeature,V>
      Specified by:
      optimize in class PropertyValue<V>
      Parameters:
      optimization - the simplifications or optimizations to apply on this expression.
      Returns:
      the simplified or optimized expression, or this if no optimization has been applied.
    • expectedType

      public final PropertyTypeBuilder expectedType(DefaultFeatureType valueType, FeatureTypeBuilder addTo)
      Provides the expected type of values produced by this expression when a feature of the given type is evaluated.
      Specified by:
      expectedType in interface FeatureExpression<AbstractFeature,V>
      Overrides:
      expectedType in class PropertyValue<V>
      Parameters:
      valueType - the type of features to be evaluated by the given expression.
      addTo - where to add the type of properties evaluated by the given expression.
      Returns:
      builder of the added property, or null if this method cannot add a property.