public class QueryProfileVariants extends Object implements com.yahoo.component.provider.Freezable, Cloneable
A set of virtual profiles are always owned by a single profile, which is also their parent in the inheritance hierarchy.
Modifier and Type | Class and Description |
---|---|
static class |
QueryProfileVariants.FieldValue |
static class |
QueryProfileVariants.FieldValues |
Modifier and Type | Field and Description |
---|---|
private List<String> |
dimensions
The names of the dimensions (which are possible properties in the context given on lookup) of this.
|
private Map<String,QueryProfileVariants.FieldValues> |
fieldValuesByName
Properties indexed by name, to support fast lookup of single values
|
private boolean |
frozen |
private QueryProfileVariants.FieldValues |
inheritedProfiles
The inherited profiles for various dimensions settings - a set of fieldvalues of List<QueryProfile>
|
private QueryProfile |
owner
The query profile this variants of
|
private List<QueryProfileVariant> |
variants
Field and inherited profiles sorted by specificity used for all-value visiting.
|
Constructor and Description |
---|
QueryProfileVariants(List<String> dimensions,
QueryProfile owner)
Creates a set of virtual query profiles which may return varying values over the set of dimensions given.
|
QueryProfileVariants(String[] dimensions,
QueryProfile owner)
Creates a set of virtual query profiles which may return varying values over the set of dimensions given.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
accept(boolean allowContent,
QueryProfileType type,
QueryProfileVisitor visitor,
DimensionBinding dimensionBinding)
Visits the most specific match to the dimension binding of each variable (or the one named by the visitor)
|
(package private) void |
acceptAllValues(boolean allowContent,
QueryProfileVisitor visitor,
QueryProfileType type,
DimensionBinding dimensionBinding) |
(package private) void |
acceptSingleValue(String name,
boolean allowContent,
QueryProfileVisitor visitor,
DimensionBinding dimensionBinding) |
QueryProfileVariants |
clone() |
protected void |
ensureNotFrozen()
Throws an IllegalStateException if this is frozen
|
void |
freeze()
Irreversibly prevents any further modifications to this
|
Object |
get(String name,
QueryProfileType type,
boolean allowQueryProfileResult,
DimensionBinding dimensionBinding)
Returns the most specific matching value of a name for a given set of canonical dimension values.
|
List<String> |
getDimensions()
Returns the dimensions over which the virtual profiles in this may return different values.
|
Map<String,QueryProfileVariants.FieldValues> |
getFieldValues()
Returns the map of field values of this indexed by field name.
|
QueryProfileVariants.FieldValues |
getInherited()
Returns the profiles inherited from various variants of this
|
QueryProfileVariant |
getVariant(DimensionValues dimensionValues,
boolean create)
Returns the query profile variant having exactly the given dimensions, and creates it if create is set and
it is missing
|
List<QueryProfileVariant> |
getVariants()
Returns all the variants of this, sorted by specificity.
|
void |
inherit(QueryProfile profile,
DimensionValues dimensionValues)
Inherits a particular profile in a variant of this
|
boolean |
isFrozen() |
void |
set(String fieldName,
DimensionValues dimensionValues,
Object value)
Sets a value to this
|
private boolean frozen
private Map<String,QueryProfileVariants.FieldValues> fieldValuesByName
private QueryProfileVariants.FieldValues inheritedProfiles
private List<QueryProfileVariant> variants
private List<String> dimensions
private QueryProfile owner
public QueryProfileVariants(String[] dimensions, QueryProfile owner)
public QueryProfileVariants(List<String> dimensions, QueryProfile owner)
dimensions
- the dimension names this may vary over. The list gets owned by this, so it must not be further
modified from outside). This will not modify the list.public void freeze()
freeze
in interface com.yahoo.component.provider.Freezable
public boolean isFrozen()
isFrozen
in interface com.yahoo.component.provider.Freezable
void accept(boolean allowContent, QueryProfileType type, QueryProfileVisitor visitor, DimensionBinding dimensionBinding)
void acceptSingleValue(String name, boolean allowContent, QueryProfileVisitor visitor, DimensionBinding dimensionBinding)
void acceptAllValues(boolean allowContent, QueryProfileVisitor visitor, QueryProfileType type, DimensionBinding dimensionBinding)
public Object get(String name, QueryProfileType type, boolean allowQueryProfileResult, DimensionBinding dimensionBinding)
name
- the name to return the best matching value ofdimensionBinding
- the dimension bindings to use in thispublic void inherit(QueryProfile profile, DimensionValues dimensionValues)
public void set(String fieldName, DimensionValues dimensionValues, Object value)
fieldName
- the name of the field to set. This cannot be a compound (dotted) namedimensionValues
- the dimension values for which this value appliesvalue
- the value to setpublic List<String> getDimensions()
public Map<String,QueryProfileVariants.FieldValues> getFieldValues()
public QueryProfileVariants.FieldValues getInherited()
public List<QueryProfileVariant> getVariants()
public QueryProfileVariants clone()
protected void ensureNotFrozen()
public QueryProfileVariant getVariant(DimensionValues dimensionValues, boolean create)
dimensionValues
- the dimension valuescreate
- whether or not to create the variant if missingCopyright © 2017. All rights reserved.