public class Location extends Object implements Serializable
fh_location
parameter.
Locations always specify a universe and locale.
Additionally they may contain zero or more criteria (modelled
through Criterion
instances), filters and targets.
All remove*()
and set*()
methods provided by this class
return the Location
instance on which they are applied. This is
useful for chained manipulations such as the following:
location.removeSearchCriteria().addCriterion(...);
Constructor and Description |
---|
Location(Location location)
Copy constructor.
|
Location(String location)
Creates a
Location instance by parsing the given string. |
Location(String universe,
String locale)
Constructs a minimal
Location instance. |
Modifier and Type | Method and Description |
---|---|
Location |
addCriterion(Criterion criterion)
Adds the given
Criterion to the back of this location. |
boolean |
equals(Object o) |
List |
getAllCriteria()
Returns all
Criterion instances contained in this location. |
List |
getCriteria(String attribute)
Returns all
Criterion instances that operate on the attribute
with the given name. |
Criterion |
getCriterion(int position)
Returns the
Criterion at the given position, if any. |
Criterion |
getCriterion(String attribute)
Returns the first
Criterion instance that operates on the
attribute with the given name, if any. |
Criterion |
getLastCriterion()
Returns last
Criterion from this location, if any. |
String |
getLocale()
Returns the locale of this location.
|
SearchCriterion |
getSearchCriterion()
Returns the first (and presumably only)
SearchCriterion in this
location, if any. |
String |
getUniverse()
Returns the universe of this
Location . |
int |
hashCode() |
protected boolean |
isValidAttributeName(String str)
Deprecated.
This method is not used internally by this class; subclasses
can use
CriterionFactory.isValidAttributeName(CharSequence)
instead. |
protected Criterion |
parseCriterion(String criterion)
Converts the string representation of a criterion into a corresponding
Criterion instance. |
Location |
removeAllCriteria()
Removes all criteria, filters and targets from this location, but
preserves the configured universe and locale.
|
Location |
removeCriteria(String attribute)
Removes all
Criterion instances that operate on the attribute
with the given name. |
Location |
removeCriterion(int position)
Removes the
Criterion at the given position, if any. |
Location |
removeLastCriterion()
Removes last
Criterion from this location, if any. |
Location |
removeSearchCriteria()
Removes all
SearchCriterion instances from the list of
Criterion objects that make up this location. |
Location |
setLocale(String localeParam)
Sets a new locale for this location.
|
Location |
setUniverse(String universeParam)
Sets a new universe for this location.
|
int |
size()
Returns the number of
Criterion instances contained in this
location. |
String |
toString()
Returns a syntactically correct string representation of this location,
such that it can be interpreted by FAS.
|
public Location(Location location)
location
- The Location
instance that is to be cloned.public Location(String universe, String locale)
Location
instance.universe
- A valid (non-null
, non-empty) universe.locale
- A valid (non-null
, non-empty) locale.IllegalArgumentException
- If either the universe or locale is malformed.public Location(String location)
Location
instance by parsing the given string.
The syntax of location strings can roughly be described as follows:
SingleValuedCriterion
|
attribute=value | equals to value |
attribute<value | small or equal to value | |
attribute>value | greater or equal to value | |
value1<attribute<value2 | between values | |
value1>attribute>value2 | between values | |
MultiValuedCriterion |
attribute={value1,value2,...} | equals to set |
attribute<{value1,value2,...} | contained in (subset of) | |
attribute>{value1,value2,...} | contains | |
attribute>{value1;value2;...} | contains at least one out of | |
!attribute>{value} | does not contain | |
FunctionCriterion |
function_name(argument,...)=value | function with arginets must be equal to value |
SearchCriterion |
$s=search_phrase;t=profile;p=passId | search for search_phrase with profile and passId |
location
- The string representation from which to create a new
Location
instance.IllegalArgumentException
- If the location cannot be parsed successfully.@Deprecated protected boolean isValidAttributeName(String str)
CriterionFactory.isValidAttributeName(CharSequence)
instead.
Equivalently, this method tells whether the given string is permissible as a universe or locale identifier.
str
- The string to test.true
if str can be an attribute name, universe
or locale; false
otherwise.protected Criterion parseCriterion(String criterion)
Criterion
instance.public String toString()
Important: this method will not encode this string in any way. One will have to post-process this string if one is to pass this location around as part of an HTTP query string.
public String getUniverse()
Location
.setUniverse(String)
public Location setUniverse(String universeParam)
universeParam
- The new universe.Location
instance; useful for chained manipulations.IllegalArgumentException
- If universe is null
or empty.getUniverse()
public String getLocale()
setLocale(String)
public Location setLocale(String localeParam)
localeParam
- The new locale.Location
instance; useful for chained manipulations.IllegalArgumentException
- If locale is null
or empty.getLocale()
public Location addCriterion(Criterion criterion)
Criterion
to the back of this location.criterion
- The new criterion.Location
instance; useful for chained manipulations.IllegalArgumentException
- If criterion is null
.public List getAllCriteria()
Criterion
instances contained in this location.removeAllCriteria()
public Location removeAllCriteria()
Location
instance; useful for chained manipulations.getAllCriteria()
public SearchCriterion getSearchCriterion()
SearchCriterion
in this
location, if any.SearchCriterion
if present; null
otherwise.removeSearchCriteria()
public Location removeSearchCriteria()
SearchCriterion
instances from the list of
Criterion
objects that make up this location.Location
instance; useful for chained manipulations.getSearchCriterion()
public Criterion getCriterion(String attribute)
Criterion
instance that operates on the
attribute with the given name, if any.attribute
- The non-ML name of the attribute on which this criterion
operates.Criterion
that references the specified
attribute.getCriteria(String)
,
removeCriteria(String)
public List getCriteria(String attribute)
Criterion
instances that operate on the attribute
with the given name.attribute
- The non-ML name of the attribute on which this criterion
operates.getCriterion(String)
,
removeCriteria(String)
public Location removeCriteria(String attribute)
Criterion
instances that operate on the attribute
with the given name.attribute
- The non-ML name of the attribute on which this criterion
operates.Location
instance; useful for chained manipulations.getCriterion(String)
,
getCriteria(String)
public Criterion getCriterion(int position)
Criterion
at the given position, if any.position
- The position of the criterion that is the be returned.Criterion
at position position, if any;
null
otherwise.removeCriterion(int)
public Location removeCriterion(int position)
Criterion
at the given position, if any.
If there is no criterion at the specified location, then the internal
state of this Location
object remains unaltered.
position
- The position from which the criterion should be removed.Location
instance; useful for chained manipulations.getCriterion(int)
public Criterion getLastCriterion()
Criterion
from this location, if any.Criterion
, if any; null
otherwise.removeLastCriterion()
public Location removeLastCriterion()
Criterion
from this location, if any.Location
instance; useful for chained manipulations.getLastCriterion()
public int size()
Criterion
instances contained in this
location.public boolean equals(Object o)
Important: this method implements a very rudimentary equivalence test. It is not concerned with the ordering of criteria, filters and targets. On the other hand, it only compares individual criteria. I.e., it does not tests whether a set of criteria A is semantically equivalent to some other set of criteria B.
Copyright © 2021 RWS Group for and on behalf of its affiliates and subsidiaries. All rights reserved.