public class Join extends Object
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:
getTypeName()
getJoinFilter()
getProperties()
getFilter()
getAlias()
getType()
Modifier and Type | Class and Description |
---|---|
static class |
Join.Type
type of join
|
Constructor and Description |
---|
Join(Join other)
Constructs a join from another.
|
Join(String typeName,
Filter join)
Constructs a join.
|
Modifier and Type | Method and Description |
---|---|
Join |
alias(String alias)
Chaining method for
setAlias(String) |
String |
attributeName()
Convenience method that returns the attribute name to be used for this join.
|
Join |
filter(Filter filter)
Chaining method for
setFilter(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 for
getProperties() |
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 for
setType(Type) |
public Join(String typeName, Filter join)
typeName
- The name of the feature type to join to.join
- The filter specifying the join condition between the two feature types being
joined.public Join(Join other)
public String getTypeName()
This name may be the same as the name of the primary feature type, this is how a self join is specified.
public Filter getJoinFilter()
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");
public Join.Type getType()
Join.Type.INNER
is the default join type.
public List<PropertyName> getProperties()
This method has the same purpose as Query.getProperties()
.
public void setProperties(List<PropertyName> properties)
This method has the same purpose as Query.setProperties(List)
.
public String[] getPropertyNames()
This method has the same purpose as Query.getPropertyNames()
.
public void setFilter(Filter filter)
getFilter()
public Filter getFilter()
This filter must only reference attributes from the joined feature type, and not of any other feature types involved in the join.
public void setAlias(String alias)
getAlias()
public String getAlias()
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");
getJoinFilter()
public String attributeName()
Convenience for:
return getAlias() != null ? getAlias() : getTypeName();
public Join properties(String... properties)
getProperties()
public Join filter(Filter filter)
setFilter(Filter)
public Join alias(String alias)
setAlias(String)
public Join type(Join.Type type)
setType(Type)
Copyright © 1996–2019 Geotools. All rights reserved.