public static class MultiGraphQualifierHierarchy.MultiGraphFactory
extends java.lang.Object
GraphQualifierHierarchy
. A factory can be used
to create at most one GraphQualifierHierarchy
.
To create a hierarchy, a client may do so in three steps:
addQualifier(AnnotationMirror)
;
addSubtype(AnnotationMirror, AnnotationMirror)
build()
.
addSubtype(AnnotationMirror, AnnotationMirror)
adds the two qualifiers
to the hierarchy if they are not already in.
Also, once the client builds a hierarchy through build()
, no further
modifications are allowed nor can it making a new instance.
Clients build the hierarchy using addQualifier(AnnotationMirror)
and addSubtype(AnnotationMirror, AnnotationMirror)
, then get the instance with calling build()
Modifier and Type | Field and Description |
---|---|
protected AnnotatedTypeFactory |
atypeFactory
The annotated type factory associated with this hierarchy.
|
protected java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> |
polyQualifiers
Map from qualifier hierarchy to the corresponding polymorphic qualifier.
|
protected java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> |
supertypesDirect
Map from qualifiers to the direct supertypes of the qualifier.
|
Constructor and Description |
---|
MultiGraphFactory(AnnotatedTypeFactory atypeFactory)
Create a factory.
|
Modifier and Type | Method and Description |
---|---|
void |
addQualifier(javax.lang.model.element.AnnotationMirror qual)
Adds the passed qualifier to the hierarchy.
|
void |
addSubtype(javax.lang.model.element.AnnotationMirror sub,
javax.lang.model.element.AnnotationMirror sup)
Adds a subtype relationship between the two type qualifiers.
|
protected void |
assertNotBuilt()
Throw an exception if the factory was already built.
|
QualifierHierarchy |
build()
Returns an instance of
GraphQualifierHierarchy that represents the hierarchy
built so far. |
protected QualifierHierarchy |
createQualifierHierarchy() |
protected final java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypesDirect
protected final java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers
protected final AnnotatedTypeFactory atypeFactory
public MultiGraphFactory(AnnotatedTypeFactory atypeFactory)
public void addQualifier(javax.lang.model.element.AnnotationMirror qual)
addSubtype(AnnotationMirror, AnnotationMirror)
.public void addSubtype(javax.lang.model.element.AnnotationMirror sub, javax.lang.model.element.AnnotationMirror sup)
sub
- the sub type qualifiersup
- the super type qualifierpublic QualifierHierarchy build()
GraphQualifierHierarchy
that represents the hierarchy
built so far.protected QualifierHierarchy createQualifierHierarchy()
protected void assertNotBuilt()