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 . |
Result |
isSuperInvariant(FieldInvariants superInvar,
AnnotatedTypeFactory factory) |
boolean |
isWellFormed() |
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
public Result isSuperInvariant(FieldInvariants superInvar, AnnotatedTypeFactory factory)
superInvar
is a super invariant, otherwise returns a Result with the
error message