Package org.geotools.feature.visitor
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 withGroupByVisitor
). THecreate(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 Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract FeatureCalc
create(Expression expression)
Factory method creating a visitor using an aggregate attribute.abstract Class
getTargetType(Class inputType)
Retruns the type of the result, given the type of the input.static Aggregate
valueOf(String name)
Returns the enum constant of this type with the specified name.static Aggregate
valueOfIgnoreCase(String visitorName)
Helper method that given a visitor name returns the appropriate enum constant.static Aggregate[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.abstract CalcResult
wrap(Expression expression, Object value)
Wraps a raw value in the appropriate visitor calculation result.
-
-
-
Enum Constant Detail
-
AVERAGE
public static final Aggregate AVERAGE
-
COUNT
public static final Aggregate COUNT
-
MAX
public static final Aggregate MAX
-
MEDIAN
public static final Aggregate MEDIAN
-
MIN
public static final Aggregate MIN
-
STD_DEV
public static final Aggregate STD_DEV
-
SUM
public static final Aggregate SUM
-
SUMAREA
public static final Aggregate SUMAREA
-
-
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 nameNullPointerException
- 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
-
-