public static class MultiGraphQualifierHierarchy.MultiGraphFactory extends 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 Map<AnnotationMirror,AnnotationMirror> |
polyQualifiers
Map from qualifier hierarchy to the corresponding polymorphic qualifier.
|
protected Map<AnnotationMirror,Set<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(AnnotationMirror qual)
Adds the passed qualifier to the hierarchy.
|
void |
addSubtype(AnnotationMirror sub,
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 Map<AnnotationMirror,Set<AnnotationMirror>> supertypesDirect
protected final Map<AnnotationMirror,AnnotationMirror> polyQualifiers
protected final AnnotatedTypeFactory atypeFactory
public MultiGraphFactory(AnnotatedTypeFactory atypeFactory)
public void addQualifier(AnnotationMirror qual)
addSubtype(AnnotationMirror, AnnotationMirror)
.public void addSubtype(AnnotationMirror sub, 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()