Class Join
Query
.
The Join class is similar to Query in that it allows one to specify a FeatureType name, a set of properties, and a filter. A Join must specify:
- A type name that references the feature type to join to, see
getTypeName()
- A join filter that describes how to join, see
getJoinFilter()
- A set of property names constraining the attributes of joined features, see
getProperties()
- A secondary filter used to constrained features from the joined feature type, see
getFilter()
- An alias for the joined feature type, which can be used in the join filter to disambiguate attributes of the
feature types being joined, see
getAlias()
- A join type specifying what type of join (inner, outer, etc...) should be performed, see
getType()
- Since:
- 8.0
- Author:
- Justin Deoliveira, OpenGeo
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionChaining method forsetAlias(String)
Convenience method that returns the attribute name to be used for this join.Chaining method forsetFilter(Filter)
getAlias()
An alias for the feature type being joined to.Filter used to constrain which features from the joined feature type to return.The filter defining the join condition between the primary feature type and the feature type being joined to.List of properties specifying which attributes of joined features to obtain.String[]
List of property names specifying which attributes of joined features to obtain.getType()
The type of the join.The name of the feature type being joined to.properties
(String... properties) Chaining method forgetProperties()
void
Sets an alias for the feature type being joined to.void
Sets the filter used to constrain which features from the joined feature type to return.void
setProperties
(List<PropertyName> properties) Sets list of properties specifying which attributes of joined features to obtain.void
Sets the join type.Chaining method forsetType(Type)
-
Constructor Details
-
Join
Constructs a join.- Parameters:
typeName
- The name of the feature type to join to.join
- The filter specifying the join condition between the two feature types being joined.
-
Join
Constructs a join from another.
-
-
Method Details
-
getTypeName
The name of the feature type being joined to.This name may be the same as the name of the primary feature type, this is how a self join is specified.
-
getJoinFilter
The filter defining the join condition between the primary feature type and the feature type being joined to.This filter should be a comparison operator whose contents are two
PropertyName
instances. For example:new Join("theOtherType", propertyIsEqualTo(propertyName("foo"), propertyName("bar")));
In instances where the two property names involved in the join are the same a prefix or alias must be used to differentiate:Join j = new Join("theOtherType", propertyIsEqualTo(propertyName("foo"), propertyName("other.bar"))); j.alias("other");
-
setType
Sets the join type.- See Also:
-
getType
The type of the join.Join.Type.INNER
is the default join type. -
getProperties
List of properties specifying which attributes of joined features to obtain.This method has the same purpose as
Query.getProperties()
. -
setProperties
Sets list of properties specifying which attributes of joined features to obtain.This method has the same purpose as
Query.setProperties(List)
. -
getPropertyNames
List of property names specifying which attributes of joined features to obtain.This method has the same purpose as
Query.getPropertyNames()
. -
setFilter
Sets the filter used to constrain which features from the joined feature type to return.- See Also:
-
getFilter
Filter used to constrain which features from the joined feature type to return.This filter must only reference attributes from the joined feature type, and not of any other feature types involved in the join.
-
setAlias
Sets an alias for the feature type being joined to.- See Also:
-
getAlias
An alias for the feature type being joined to.This method is useful in cases where the two feature types being joined contain attributes identically named, or in cases where a self join is being performed:
Join j = new Join("theOtherType", PropertyIsEqualTo(PropertyName("foo"), PropertyName("other.foo"))); j.setAlias("other");
- See Also:
-
attributeName
Convenience method that returns the attribute name to be used for this join.Convenience for:
return getAlias() != null ? getAlias() : getTypeName();
-
properties
Chaining method forgetProperties()
-
filter
Chaining method forsetFilter(Filter)
-
alias
Chaining method forsetAlias(String)
-
type
Chaining method forsetType(Type)
-