Package com.yahoo.search.query.profile
Class SubstituteString
java.lang.Object
com.yahoo.search.query.profile.SubstituteString
A string which contains one or more elements of the form %{name},
where these occurrences are to be replaced by a query profile lookup on name.
This objects does the analysis on creation and provides a (reasonably) fast method of performing the actual substitution (at lookup time).
This is a value object. Lookups in this are thread safe.
- Author:
- bratseth
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static final class
static final class
A component where the value should be looked up in the profile containing the substitution field rather than globallystatic final class
-
Constructor Summary
ConstructorDescriptionSubstituteString
(List<SubstituteString.Component> components, String stringValue) -
Method Summary
Modifier and TypeMethodDescriptionstatic SubstituteString
Returns a new SubstituteString if the given string contains substitutions, null otherwise.boolean
int
hashCode()
boolean
Returns whether this has at least one relative componentsubstitute
(Map<String, String> context, com.yahoo.processing.request.Properties substitution) Perform the substitution in this, by looking up in the given properties, and returns the resulting stringtoString()
Returns this string in original (unsubstituted) form
-
Constructor Details
-
SubstituteString
-
-
Method Details
-
create
Returns a new SubstituteString if the given string contains substitutions, null otherwise. -
hasRelative
public boolean hasRelative()Returns whether this has at least one relative component -
substitute
public Object substitute(Map<String, String> context, com.yahoo.processing.request.Properties substitution) Perform the substitution in this, by looking up in the given properties, and returns the resulting string- Parameters:
context
- the content which is used to resolve profile variants when looking up substitution valuessubstitution
- the properties in which values to be substituted are looked up
-
components
-
stringValue
-
hashCode
public int hashCode() -
equals
-
toString
Returns this string in original (unsubstituted) form
-