Class PropertyValue.CastedAndConverted<S,V>

Type Parameters:
S - the type of source value before conversion.
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>
Enclosing class:
PropertyValue<V>

private static final class PropertyValue.CastedAndConverted<S,V> extends PropertyValue.Converted<V>
An expression fetching property values as an object of specified type. The value is first casted from Object to the expected source type, then converted to the specified target type.
  • Field Details

    • serialVersionUID

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

      private final Class<S> source
      The source type before conversion.
    • converter

      private final ObjectConverter<? super S,? extends V> converter
      The conversion from source type to the type to be returned.
  • Constructor Details

    • CastedAndConverted

      CastedAndConverted(Class<S> source, Class<V> type, String xpath, boolean isVirtual)
      Creates a new expression retrieving values from a property of the given name.
  • Method Details

    • getSourceClass

      protected Class<S> getSourceClass()
      Returns the type of values fetched from AbstractFeature instance.
      Overrides:
      getSourceClass in class PropertyValue<V>
    • 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.
      Specified by:
      apply in interface Expression<S,V>
      Specified by:
      apply in interface Function<S,V>
      Overrides:
      apply in class PropertyValue.Converted<V>
      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.