Enum Aggregate

  • All Implemented Interfaces:
    Serializable, Comparable<Aggregate>

    public enum Aggregate
    extends Enum<Aggregate>
    Aggregate functions defined for use with the GeoTools library.

    Aggregates are backed by a FeatureCalc visitor for direct use with a FeatureCollection (or use with GroupByVisitor ). THe create(Expression) method is used as a factory method to configure an appropriate visitor.

    During processing a CalcResult is used to store intermediate results. Implementations that handle an aggregate function directly (such as JDBCDataStore) can use can use the wrap method to generate the expect CalcResult from a calculated raw value.

    • Method Detail

      • values

        public static Aggregate[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Aggregate c : Aggregate.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Aggregate valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • create

        public abstract FeatureCalc create​(Expression expression)
        Factory method creating a visitor using an aggregate attribute.
        Parameters:
        expression - Expression used to sample collection (often a PropertyName)
        Returns:
        a new instance of the visitor
      • wrap

        public abstract CalcResult wrap​(Expression expression,
                                        Object value)
        Wraps a raw value in the appropriate visitor calculation result. The typical usage of this is to wrap values returned by stores able to handle the visitor (for example the JDBCDataStore).
        Parameters:
        expression - Expression used to sample collection (often a PropertyName)
        value - The raw value to be wrapped
        Returns:
        value Wrapped in the appropriate visitor calculation result
      • getTargetType

        public abstract Class getTargetType​(Class inputType)
        Retruns the type of the result, given the type of the input. Will throw an exception if the input type is not acceptable
        Returns:
      • valueOfIgnoreCase

        public static Aggregate valueOfIgnoreCase​(String visitorName)
        Helper method that given a visitor name returns the appropriate enum constant.

        The performed match by name is more permissive that the default one. The match will not be case sensitive and slightly different names can be used (camel case versus snake case).

        Parameters:
        visitorName - the visitor name
        Returns:
        this enum constant that machs the visitor name