Package com.tonic.analysis.query.eval
Class AttributeRegistry
- java.lang.Object
-
- com.tonic.analysis.query.eval.AttributeRegistry
-
public final class AttributeRegistry extends Object
Maps(SubjectKind, keyword)to a resolver - either a scalarAttributeRegistry.Attributeor a sub-subjectAttributeRegistry.Selector.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAttributeRegistry.AttributeResolves a scalar value from a subject.static classAttributeRegistry.EntryA registered resolver: exactly one ofscalar/streamis non-null.static interfaceAttributeRegistry.SelectorExpands a subject into a stream of sub-subjects (honoring the step's index/wildcard).
-
Constructor Summary
Constructors Constructor Description AttributeRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeRegistry.Entrylookup(SubjectKind kind, String keyword)Finds the resolver registered for a keyword; keyword matching is case-insensitive.voidregisterScalar(SubjectKind kind, String keyword, AttributeRegistry.Attribute attribute)Registers a keyword that resolves to a scalar value.voidregisterStream(SubjectKind kind, String keyword, AttributeRegistry.Selector selector)Registers a keyword that expands a subject into sub-subjects.
-
-
-
Method Detail
-
registerScalar
public void registerScalar(SubjectKind kind, String keyword, AttributeRegistry.Attribute attribute)
Registers a keyword that resolves to a scalar value.- Parameters:
kind- the subject kind the keyword applies tokeyword- the attribute keywordattribute- the resolver- Throws:
IllegalStateException- if the kind and keyword are already registered
-
registerStream
public void registerStream(SubjectKind kind, String keyword, AttributeRegistry.Selector selector)
Registers a keyword that expands a subject into sub-subjects.- Parameters:
kind- the subject kind the keyword applies tokeyword- the attribute keywordselector- the expansion- Throws:
IllegalStateException- if the kind and keyword are already registered
-
lookup
public AttributeRegistry.Entry lookup(SubjectKind kind, String keyword)
Finds the resolver registered for a keyword; keyword matching is case-insensitive.- Parameters:
kind- the subject kind the keyword is used onkeyword- the attribute keyword- Returns:
- the entry, or null if nothing is registered
-
-