Class Join
- Object
-
- Join
-
public class Join extends Object
Represents the joining of two feature types within aQuery
.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
- A type name that references the feature type to join to, see
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Join.Type
type of join
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Join
alias(String alias)
Chaining method forsetAlias(String)
String
attributeName()
Convenience method that returns the attribute name to be used for this join.Join
filter(Filter filter)
Chaining method forsetFilter(Filter)
String
getAlias()
An alias for the feature type being joined to.Filter
getFilter()
Filter used to constrain which features from the joined feature type to return.Filter
getJoinFilter()
The filter defining the join condition between the primary feature type and the feature type being joined to.List<PropertyName>
getProperties()
List of properties specifying which attributes of joined features to obtain.String[]
getPropertyNames()
List of property names specifying which attributes of joined features to obtain.Join.Type
getType()
The type of the join.String
getTypeName()
The name of the feature type being joined to.Join
properties(String... properties)
Chaining method forgetProperties()
void
setAlias(String alias)
Sets an alias for the feature type being joined to.void
setFilter(Filter filter)
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
setType(Join.Type type)
Sets the join type.Join
type(Join.Type type)
Chaining method forsetType(Type)
-
-
-
Constructor Detail
-
Join
public Join(String typeName, Filter 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
public Join(Join other)
Constructs a join from another.
-
-
Method Detail
-
getTypeName
public String 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
public Filter 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");
-
getType
public Join.Type getType()
The type of the join.Join.Type.INNER
is the default join type.
-
getProperties
public List<PropertyName> getProperties()
List of properties specifying which attributes of joined features to obtain.This method has the same purpose as
Query.getProperties()
.
-
setProperties
public void setProperties(List<PropertyName> properties)
Sets list of properties specifying which attributes of joined features to obtain.This method has the same purpose as
Query.setProperties(List)
.
-
getPropertyNames
public String[] getPropertyNames()
List of property names specifying which attributes of joined features to obtain.This method has the same purpose as
Query.getPropertyNames()
.
-
setFilter
public void setFilter(Filter filter)
Sets the filter used to constrain which features from the joined feature type to return.- See Also:
getFilter()
-
getFilter
public Filter 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
public void setAlias(String alias)
Sets an alias for the feature type being joined to.- See Also:
getAlias()
-
getAlias
public String 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:
getJoinFilter()
-
attributeName
public String attributeName()
Convenience method that returns the attribute name to be used for this join.Convenience for:
return getAlias() != null ? getAlias() : getTypeName();
-
properties
public Join properties(String... properties)
Chaining method forgetProperties()
-
filter
public Join filter(Filter filter)
Chaining method forsetFilter(Filter)
-
alias
public Join alias(String alias)
Chaining method forsetAlias(String)
-
type
public Join type(Join.Type type)
Chaining method forsetType(Type)
-
-