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

    Constructors
    Constructor
    Description
    QueryProfileType(com.yahoo.component.ComponentId id)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 this
    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 id
    Returns all the fields of this profile type and all types it inherits as a read-only map
    void
     
    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 none
    getField(String localName)
    Returns 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 none
    boolean
    Returns whether instances of this should be matched as path names.
    getType(String localName)
    Returns the type of the given query profile type declared as a field in this
    Returns the permissible class for the value of the given name in this type
    int
     
    Returns the query profile types inherited from this (never null).
    boolean
    Returns whether this type is built into the system
    boolean
    Returns true if this is declared strict.
    boolean
    isOverridable(String fieldName)
    Returns whether the given field name is overridable in this type.
    boolean
    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.
     
    unalias(String aliasOrField)
    Returns the field name of an alias or field name
    Return this is it is not frozen, returns a modifiable deeply unfrozen copy otherwise

    Methods 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

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • QueryProfileType

      public QueryProfileType(String idString)
    • QueryProfileType

      public QueryProfileType(com.yahoo.component.ComponentId id)
  • Method Details

    • unfrozen

      public QueryProfileType 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

      public List<QueryProfileType> 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

      public Map<String,FieldDescription> 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 interface com.yahoo.component.provider.Freezable
      Overrides:
      freeze in class com.yahoo.component.provider.FreezableSimpleComponent
    • isOverridable

      public boolean isOverridable(String fieldName)
      Returns whether the given field name is overridable in this type. Default: true (so all non-declared fields returns true)
    • getValueClass

      public Class<?> getValueClass(String name)
      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

      public QueryProfileType getType(String localName)
      Returns the type of the given query profile type declared as a field in this
    • getFieldType

      public FieldType getFieldType(com.yahoo.processing.request.CompoundName name)
      Returns the type of the given name under this, of null if none
    • getField

      public FieldDescription getField(com.yahoo.processing.request.CompoundName globalName)
      Returns the description of the given name under this, of null if none
    • getField

      public FieldDescription getField(String localName)
      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

      public FieldDescription removeField(String fieldName)
      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

      public void addField(FieldDescription fieldDescription)
      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

      public void addField(FieldDescription fieldDescription, QueryProfileTypeRegistry registry)
      Adds a field to this
      Throws:
      IllegalStateException - if this is frozen
    • fields

      public Map<String,FieldDescription> fields()
      Returns all the fields of this profile type and all types it inherits as a read-only map
    • aliases

      public Map<String,String> 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

      public String unalias(String aliasOrField)
      Returns the field name of an alias or field name
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Two types are equal if they have the same id
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class com.yahoo.component.AbstractComponent