Class QueryProfileType
java.lang.Object
com.yahoo.component.AbstractComponent
com.yahoo.component.provider.FreezableSimpleComponent
com.yahoo.search.query.profile.types.QueryProfileType
- All Implemented Interfaces:
com.yahoo.component.Component
,com.yahoo.component.Deconstructable
,com.yahoo.component.provider.Freezable
,Comparable<com.yahoo.component.Component>
public class QueryProfileType
extends com.yahoo.component.provider.FreezableSimpleComponent
Defines a kind of query profiles
- Author:
- bratseth
-
Field Summary
Fields inherited from class com.yahoo.component.AbstractComponent
isDeconstructable
-
Constructor Summary
ConstructorDescriptionQueryProfileType
(com.yahoo.component.ComponentId id) QueryProfileType
(String idString) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(FieldDescription fieldDescription) Adds a field to this, without associating with a type registry; field descriptions with compound is not be supported.void
addField
(FieldDescription fieldDescription, QueryProfileTypeRegistry registry) Adds a field to thisaliases()
Returns the alias to field mapping of this type as a read-only map.Returns the fields declared in this (i.e not including those inherited) as an immutable map.boolean
Two types are equal if they have the same idfields()
Returns all the fields of this profile type and all types it inherits as a read-only mapvoid
freeze()
com.yahoo.processing.request.CompoundName
boolean
Returns true if this is declared as match as path.getField
(com.yahoo.processing.request.CompoundName globalName) Returns the description of the given name under this, of null if noneReturns the description of the field with the given name in this type or an inherited type (depth first left to right search).getFieldType
(com.yahoo.processing.request.CompoundName name) Returns the type of the given name under this, of null if noneboolean
Returns whether instances of this should be matched as path names.Returns the type of the given query profile type declared as a field in thisClass<?>
getValueClass
(String name) Returns the permissible class for the value of the given name in this typeint
hashCode()
Returns the query profile types inherited from this (never null).boolean
Returns whether this type is built into the systemboolean
Returns true if this is declared strict.boolean
isOverridable
(String fieldName) Returns whether the given field name is overridable in this type.boolean
isStrict()
Returns whether field not declared in this type is permissible in instances.removeField
(String fieldName) Removes a field from this (not from any inherited profile)void
setBuiltin
(boolean builtin) Mark this type as built into the system.void
setMatchAsPath
(boolean matchAsPath) Returns whether instances of this should be matched as path names.void
setStrict
(boolean strict) Set whether nondeclared fields are permissible.toString()
Returns the field name of an alias or field nameunfrozen()
Return this is it is not frozen, returns a modifiable deeply unfrozen copy otherwiseMethods inherited from class com.yahoo.component.provider.FreezableSimpleComponent
clone, ensureNotFrozen, isFrozen
Methods inherited from class com.yahoo.component.AbstractComponent
compareTo, deconstruct, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable
-
Constructor Details
-
QueryProfileType
-
QueryProfileType
public QueryProfileType(com.yahoo.component.ComponentId id)
-
-
Method Details
-
unfrozen
Return this is it is not frozen, returns a modifiable deeply unfrozen copy otherwise -
getComponentIdAsCompoundName
public com.yahoo.processing.request.CompoundName getComponentIdAsCompoundName() -
setBuiltin
public void setBuiltin(boolean builtin) Mark this type as built into the system. Do not use -
isBuiltin
public boolean isBuiltin()Returns whether this type is built into the system -
inherited
Returns the query profile types inherited from this (never null). If this profile type is not frozen, this list can be modified to change the set of inherited types. If it is frozen, the returned list is immutable. -
declaredFields
Returns the fields declared in this (i.e not including those inherited) as an immutable map.- Throws:
IllegalStateException
- if this is frozen
-
isDeclaredStrict
public boolean isDeclaredStrict()Returns true if this is declared strict.- Throws:
IllegalStateException
- if this is frozen
-
getDeclaredMatchAsPath
public boolean getDeclaredMatchAsPath()Returns true if this is declared as match as path.- Throws:
IllegalStateException
- if this is frozen
-
setStrict
public void setStrict(boolean strict) Set whether nondeclared fields are permissible. Throws an exception if this is frozen. -
isStrict
public boolean isStrict()Returns whether field not declared in this type is permissible in instances. Default is false: Additional values are allowed -
setMatchAsPath
public void setMatchAsPath(boolean matchAsPath) Returns whether instances of this should be matched as path names. Throws if this is frozen. -
getMatchAsPath
public boolean getMatchAsPath()Returns whether instances of this should be matched as path names. Default is false: Use exact name matching. -
freeze
public void freeze()- Specified by:
freeze
in interfacecom.yahoo.component.provider.Freezable
- Overrides:
freeze
in classcom.yahoo.component.provider.FreezableSimpleComponent
-
isOverridable
Returns whether the given field name is overridable in this type. Default: true (so all non-declared fields returns true) -
getValueClass
Returns the permissible class for the value of the given name in this type- Returns:
- the permissible class for a value,
Object
if all types are legal, null if no types are legal (i.e if the name is not legal)
-
getType
Returns the type of the given query profile type declared as a field in this -
getFieldType
Returns the type of the given name under this, of null if none -
getField
Returns the description of the given name under this, of null if none -
getField
Returns the description of the field with the given name in this type or an inherited type (depth first left to right search). Returns null if the field is not defined in this or an inherited profile. -
removeField
Removes a field from this (not from any inherited profile)- Returns:
- the removed field or null if none
- Throws:
IllegalStateException
- if this is frozen
-
addField
Adds a field to this, without associating with a type registry; field descriptions with compound is not be supported.- Throws:
IllegalStateException
- if this is frozen
-
addField
Adds a field to this- Throws:
IllegalStateException
- if this is frozen
-
fields
Returns all the fields of this profile type and all types it inherits as a read-only map -
aliases
Returns the alias to field mapping of this type as a read-only map. This is never null. Note that all keys are lower-cased because aliases are case-insensitive -
unalias
Returns the field name of an alias or field name -
hashCode
public int hashCode() -
equals
Two types are equal if they have the same id -
toString
- Overrides:
toString
in classcom.yahoo.component.AbstractComponent
-