public class FieldInvariants
extends java.lang.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,
java.util.List<java.lang.String> fields,
java.util.List<javax.lang.model.element.AnnotationMirror> qualifiers)
Creates a new object with all the invariants in
other , plus those specified by fields and qualifiers . |
FieldInvariants(java.util.List<java.lang.String> fields,
java.util.List<javax.lang.model.element.AnnotationMirror> qualifiers)
Creates a new FieldInvariants object.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getFields()
The simple names of the fields that have a qualifier.
|
java.util.List<javax.lang.model.element.AnnotationMirror> |
getQualifiersFor(java.lang.CharSequence field)
Returns a list of qualifiers for
field . |
Result |
isSuperInvariant(FieldInvariants superInvar,
AnnotatedTypeFactory factory) |
boolean |
isWellFormed() |
public FieldInvariants(java.util.List<java.lang.String> fields, java.util.List<javax.lang.model.element.AnnotationMirror> qualifiers)
fields
.fields
- list of fieldsqualifiers
- list of qualifierspublic FieldInvariants(FieldInvariants other, java.util.List<java.lang.String> fields, java.util.List<javax.lang.model.element.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 java.util.List<java.lang.String> getFields()
public java.util.List<javax.lang.model.element.AnnotationMirror> getQualifiersFor(java.lang.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