public class SpecificationBuilder
extends java.lang.Object
PBody
instances from Pattern
definitions. A single instance of this
builder is used during construction, that maintains the mapping between Pattern
and PQuery
objects,
and can be initialized with a pre-defined set of mappings.
The SpecificationBuilder is stateful: it stores all previously built specifications, allowing further re-use.
Constructor and Description |
---|
SpecificationBuilder()
Initializes a query builder with no previously known query specifications
|
SpecificationBuilder(java.util.Collection<? extends IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>>> specifications)
Sets up a query builder with a predefined collection of specifications
|
SpecificationBuilder(IQuerySpecification<?>... specifications)
Sets up a query builder with a predefined set of specifications
|
SpecificationBuilder(NameToSpecificationMap patternMap) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<PBody> |
buildBodies(Pattern pattern,
InitializablePQuery query) |
void |
forgetSpecification(IQuerySpecification<?> specification)
Forgets a specification in the builder.
|
java.util.Set<IQuerySpecification<?>> |
forgetSpecificationTransitively(IQuerySpecification<?> specification)
Forgets a specification in the builder, and also removes anything that depends on it.
|
java.util.Set<PBody> |
getBodies(Pattern pattern,
PQuery query) |
IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> |
getOrCreateSpecification(Pattern pattern)
Creates a new or returns an existing query specification for the pattern.
|
IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> |
getOrCreateSpecification(Pattern pattern,
boolean skipPatternValidation)
Creates a new or returns an existing query specification for the pattern.
|
IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> |
getOrCreateSpecification(Pattern pattern,
java.util.List<IQuerySpecification<?>> createdPatternList,
boolean skipPatternValidation) |
IQuerySpecification<?> |
getSpecification(Pattern pattern) |
IQuerySpecification<?> |
getSpecification(java.lang.String fqn) |
public SpecificationBuilder()
public SpecificationBuilder(IQuerySpecification<?>... specifications)
public SpecificationBuilder(java.util.Collection<? extends IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>>> specifications)
public SpecificationBuilder(NameToSpecificationMap patternMap)
public IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> getOrCreateSpecification(Pattern pattern) throws IncQueryException
pattern
- IncQueryException
public IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> getOrCreateSpecification(Pattern pattern, boolean skipPatternValidation) throws IncQueryException
pattern
- skipPatternValidation
- if set to true, detailed pattern validation is skipped - true for model inferrer; not recommended for
generic APIIncQueryException
public IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> getOrCreateSpecification(Pattern pattern, java.util.List<IQuerySpecification<?>> createdPatternList, boolean skipPatternValidation) throws IncQueryException
IncQueryException
public java.util.Set<PBody> buildBodies(Pattern pattern, InitializablePQuery query) throws QueryInitializationException
QueryInitializationException
public java.util.Set<PBody> getBodies(Pattern pattern, PQuery query) throws QueryInitializationException
QueryInitializationException
public IQuerySpecification<?> getSpecification(Pattern pattern)
public IQuerySpecification<?> getSpecification(java.lang.String fqn)
public void forgetSpecification(IQuerySpecification<?> specification)
Warning! Removing a specification does not change any specification created previously, even if
they are referring to the old version of the specification. Only use this if you are sure all dependant queries
are also removed, otherwise use forgetSpecificationTransitively(IQuerySpecification)
instead.
public java.util.Set<IQuerySpecification<?>> forgetSpecificationTransitively(IQuerySpecification<?> specification)
specification
-