Package com.yahoo.search.query.profile
Class BackedOverridableQueryProfile
- java.lang.Object
-
- com.yahoo.component.AbstractComponent
-
- com.yahoo.component.provider.FreezableSimpleComponent
-
- com.yahoo.search.query.profile.QueryProfile
-
- com.yahoo.search.query.profile.OverridableQueryProfile
-
- com.yahoo.search.query.profile.BackedOverridableQueryProfile
-
- All Implemented Interfaces:
com.yahoo.component.Component
,com.yahoo.component.provider.Freezable
,java.lang.Cloneable
,java.lang.Comparable<com.yahoo.component.Component>
public class BackedOverridableQueryProfile extends OverridableQueryProfile implements java.lang.Cloneable
A wrapper of a query profile where overrides to the values in the referenced profile can be set.
This is used to allow configured overrides (in a particular referencing profile) of a referenced query profile.
Properties which are defined as not overridable in the type (if any) of the referenced query profile cannot be set.
- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description BackedOverridableQueryProfile(QueryProfile backingProfile)
Creates an overridable profile from the given backing profile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInherited(QueryProfile inherited)
Adds a profile to the end of the inherited list of this.BackedOverridableQueryProfile
clone()
Returns a clone of this which can be independently overridden, but which refers to the same backing profileprotected QueryProfile
createSubProfile(java.lang.String name, DimensionBinding dimensionBinding)
Looks up all inherited profiles and adds any that matches this name.void
freeze()
Switches this from write-only to read-only mode.QueryProfile
getBacking()
Returns the query profile backing thisprotected java.util.Map<java.lang.String,java.lang.Object>
getContent()
Returns all the content from this: All the values in this, and all values in the backing where an overriding value is not set in thisprotected java.lang.Object
getContent(java.lang.String localKey)
Returns a value from the content of this: The value in this, or the value from the backing if not set in thisjava.util.List<java.lang.String>
getDimensions()
Returns the variant dimensions to be used in this - an unmodifiable list of dimension namesjava.lang.String
getSource()
boolean
isExplicit()
protected java.lang.Boolean
isLocalInstanceOverridable(java.lang.String localName)
protected java.lang.Object
localLookup(java.lang.String localName, DimensionBinding dimensionBinding)
Do a variant-aware content lookup in thisjava.lang.String
toString()
protected void
visitInherited(boolean allowContent, com.yahoo.search.query.profile.QueryProfileVisitor visitor, DimensionBinding dimensionBinding, QueryProfile owner)
protected void
visitVariants(boolean allowContent, com.yahoo.search.query.profile.QueryProfileVisitor visitor, DimensionBinding dimensionBinding)
-
Methods inherited from class com.yahoo.search.query.profile.OverridableQueryProfile
checkAndConvertAssignment
-
Methods inherited from class com.yahoo.search.query.profile.QueryProfile
accept, addInherited, addInherited, compile, convertToSubstitutionString, declaredContent, get, get, get, get, get, get, get, getFieldDescription, getType, getValue, getVariants, inherited, isDeclaredOverridable, listValues, listValues, listValues, listValues, listValues, lookup, lookup, set, set, set, set, set, set, setDimensions, setLocalNode, setOverridable, setType, setValue, validateName
-
Methods inherited from class com.yahoo.component.provider.FreezableSimpleComponent
ensureNotFrozen, isFrozen
-
-
-
-
Constructor Detail
-
BackedOverridableQueryProfile
public BackedOverridableQueryProfile(QueryProfile backingProfile)
Creates an overridable profile from the given backing profile. The backing profile will never be written to.- Parameters:
backingProfile
- the backing profile, which is assumed read only, never null
-
-
Method Detail
-
getSource
public java.lang.String getSource()
- Overrides:
getSource
in classQueryProfile
-
freeze
public void freeze()
Description copied from class:QueryProfile
Switches this from write-only to read-only mode. This profile can never be modified again after this method returns. Calling this on an already frozen profile has no effect.Calling this will also freeze any profiles inherited and referenced by this.
- Specified by:
freeze
in interfacecom.yahoo.component.provider.Freezable
- Overrides:
freeze
in classQueryProfile
-
localLookup
protected java.lang.Object localLookup(java.lang.String localName, DimensionBinding dimensionBinding)
Description copied from class:QueryProfile
Do a variant-aware content lookup in this- Overrides:
localLookup
in classQueryProfile
-
isLocalInstanceOverridable
protected java.lang.Boolean isLocalInstanceOverridable(java.lang.String localName)
- Overrides:
isLocalInstanceOverridable
in classQueryProfile
-
createSubProfile
protected QueryProfile createSubProfile(java.lang.String name, DimensionBinding dimensionBinding)
Description copied from class:QueryProfile
Looks up all inherited profiles and adds any that matches this name. This default implementation returns an empty profile.- Overrides:
createSubProfile
in classOverridableQueryProfile
-
clone
public BackedOverridableQueryProfile clone()
Returns a clone of this which can be independently overridden, but which refers to the same backing profile- Overrides:
clone
in classOverridableQueryProfile
-
getBacking
public QueryProfile getBacking()
Returns the query profile backing this
-
addInherited
public void addInherited(QueryProfile inherited)
Description copied from class:QueryProfile
Adds a profile to the end of the inherited list of this. Throws an exception if this is frozen.- Overrides:
addInherited
in classQueryProfile
-
visitVariants
protected void visitVariants(boolean allowContent, com.yahoo.search.query.profile.QueryProfileVisitor visitor, DimensionBinding dimensionBinding)
- Overrides:
visitVariants
in classQueryProfile
-
visitInherited
protected void visitInherited(boolean allowContent, com.yahoo.search.query.profile.QueryProfileVisitor visitor, DimensionBinding dimensionBinding, QueryProfile owner)
- Overrides:
visitInherited
in classQueryProfile
-
getContent
protected java.lang.Object getContent(java.lang.String localKey)
Returns a value from the content of this: The value in this, or the value from the backing if not set in this- Overrides:
getContent
in classQueryProfile
-
getContent
protected java.util.Map<java.lang.String,java.lang.Object> getContent()
Returns all the content from this: All the values in this, and all values in the backing where an overriding value is not set in this- Overrides:
getContent
in classQueryProfile
-
toString
public java.lang.String toString()
- Overrides:
toString
in classOverridableQueryProfile
-
isExplicit
public boolean isExplicit()
- Overrides:
isExplicit
in classQueryProfile
-
getDimensions
public java.util.List<java.lang.String> getDimensions()
Description copied from class:QueryProfile
Returns the variant dimensions to be used in this - an unmodifiable list of dimension names- Overrides:
getDimensions
in classQueryProfile
-
-