public static class MultiGraphQualifierHierarchy.MultiGraphFactory extends @NonNull 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:
1. add qualifiers using addQualifier(AnnotationMirror)
;
2. add subtype relations using addSubtype(AnnotationMirror, AnnotationMirror)
3. build the hierarchy and gets using build()
.
Notice that 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 AnnotationUtils |
annoFactory |
protected BaseTypeChecker |
checker |
protected Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> |
polyQualifiers
Map from qualifier hierarchy to the corresponding polymorphic qualifier.
|
protected Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> |
supertypes
Map from qualifiers to the direct supertypes of the qualifier.
|
Constructor and Description |
---|
MultiGraphQualifierHierarchy.MultiGraphFactory(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
void |
addQualifier(@Nullable AnnotationMirror qual)
Adds the passed qualifier to the hierarchy.
|
void |
addSubtype(@Nullable AnnotationMirror sub,
@Nullable AnnotationMirror sup)
Adds a subtype relationship between the two type qualifiers.
|
protected void |
assertNotBuilt() |
QualifierHierarchy |
build()
Returns an instance of
GraphQualifierHierarchy that
represents the hierarchy built so far |
protected QualifierHierarchy |
createQualifierHierarchy() |
protected final Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes
protected final Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> polyQualifiers
protected final BaseTypeChecker checker
protected final AnnotationUtils annoFactory
public MultiGraphQualifierHierarchy.MultiGraphFactory(BaseTypeChecker checker)
public void addQualifier(@Nullable AnnotationMirror qual)
addSubtype(AnnotationMirror, AnnotationMirror)
.public void addSubtype(@Nullable AnnotationMirror sub, @Nullable AnnotationMirror sup)
sub
- the sub type qualifiersup
- the super type qualifierpublic QualifierHierarchy build()
GraphQualifierHierarchy
that
represents the hierarchy built so farprotected QualifierHierarchy createQualifierHierarchy()
protected void assertNotBuilt()