Class 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
    • Constructor Detail

      • QueryProfileType

        public QueryProfileType​(String idString)
      • QueryProfileType

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

      • 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.
      • 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 field type of the given name under this, of null if none
      • getField

        public FieldDescription getField​(String name)
        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
      • 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