public class FieldInvariants extends Object
@FieldInvariant
. Think of
this as a set of (field, qualifier) pairs.
A FieldInvariants object may be malformed (inconsistent number of fields and qualifiers). In this case, the BaseTypeVisitor will issue an error.
Constructor and Description |
---|
FieldInvariants(FieldInvariants other,
List<String> fields,
List<AnnotationMirror> qualifiers)
Creates a new object with all the invariants in
other , plus those specified by fields and qualifiers . |
FieldInvariants(List<String> fields,
List<AnnotationMirror> qualifiers)
Creates a new FieldInvariants object.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getFields()
The simple names of the fields that have a qualifier.
|
List<AnnotationMirror> |
getQualifiersFor(CharSequence field)
Returns a list of qualifiers for
field . |
DiagMessage |
isSuperInvariant(FieldInvariants superInvar,
AnnotatedTypeFactory factory)
Returns null if
superInvar is a super invariant, otherwise returns the error message. |
boolean |
isWellFormed()
Returns true if there is a qualifier for each field in
fields . |
public FieldInvariants(List<String> fields, List<AnnotationMirror> qualifiers)
fields
.fields
- list of fieldsqualifiers
- list of qualifierspublic FieldInvariants(FieldInvariants other, List<String> fields, List<AnnotationMirror> qualifiers)
other
, plus those specified by fields
and qualifiers
. The result is well-formed if length of qualifiers is either 1
or equal to length of fields
.other
- other invariant object, may be nullfields
- list of fieldsqualifiers
- list of qualifierspublic List<String> getFields()
public List<AnnotationMirror> getQualifiersFor(CharSequence field)
field
. If field
has no qualifiers, returns
an empty list.field
- simple field namefield
, possibly emptypublic boolean isWellFormed()
fields
.fields
public DiagMessage isSuperInvariant(FieldInvariants superInvar, AnnotatedTypeFactory factory)
superInvar
is a super invariant, otherwise returns the error message.superInvar
- the value to check for being a super invariantfactory
- the type factorysuperInvar
is a super invariant, otherwise returns the error message