Package org.apache.openjpa.meta
Class AccessCode
java.lang.Object
org.apache.openjpa.meta.AccessCode
Represents access styles for members of a class and field through a
5-bit integer.
The bits designate following aspects of access style being used at class level:
Bit position 0 (UNKNOWN): generally 0. All bits as zero represent
that no access style has been set. 1 denotes that the
class has no property at all and its access can not be
determined.
Bit position 1 (FIELD): Field based access is default
Bit position 2 (PROPERTY): Property based access is default
Bit position 3 (EXPLICIT): whether explicit or implicit
Explicit access style allows members to use mixed access style,
implicit access style does not
Bit position 4 (MIXED): whether all members are using the same
access style or not. Can only be set if EXPLICT bit is set.
If set, then bit 1 or 2 denotes what is the default.
The same bits designate following aspects of access style being used at field level:
Bit position 0 (UNKNOWN): always 0. All bits as zero represent
that no access style has been set.
Bit position 1 (FIELD): Field based access is default
Bit position 2 (PROPERTY): Property based access is default
Bit position 3 (EXPLICIT): whether the access is explicit or implicit
Bit position 4 (MIXED): not used
1. Only one of the position 1 (FIELD) and 2 (PROPERTY) can
be set. A single bit is not used for legacy reason to cope with the access
constants used in ClassMetaData which this class now refactors to address
new behaviors specified in JPA 2.0 specification.
2. if position 3 (EXPLICIT) is set then one of position 1
(FIELD) and 2 (PROPERTY) must be set.
3. If position 4 (MIXED) is set then the set position of either
FIELD or PROPERTY designates the default access of the
member.
The bits designate following aspects of access style being used at class level:
The same bits designate following aspects of access style being used at field level:
Validation Rules for the bits:
- Since:
- 2.0.0
- Author:
- Pinaki Poddar
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetMixedCode(int cCode, int fCode) static booleanisCompatibleSuper(int subCode, int superCode) Affirms if the sub class access type is compatible with super class access style.static booleanisEmpty(int code) static booleanisEmpty(ClassMetaData meta) static booleanisExplicit(int code) static booleanisField(int code) static booleanisField(ClassMetaData meta) static booleanisField(FieldMetaData meta) static booleanisMixed(int code) Affirms if the given code designates that members can use both FIELD and PROPERTY based access.static booleanisProperty(int code) static booleanisProperty(ClassMetaData meta) static booleanisProperty(FieldMetaData meta) static booleanisUnknown(int code) static booleanisUnknown(ClassMetaData meta) static booleanisUnknown(FieldMetaData meta) static booleanisValidClassCode(int code) Affirms if the given code is valid.static booleanisValidFieldCode(int code) static intmergeFieldCode(int cCode, int fCode) Merges the field access type with the class access type provided such merge is valid.static intmergeFieldCode(ClassMetaData meta, FieldMetaData fmd, int fCode) static StringtoClassString(int code) static inttoFieldCode(int code) static StringtoFieldString(int code)
-
Field Details
-
UNKNOWN
public static int UNKNOWN -
EMPTY
public static int EMPTY -
FIELD
public static int FIELD -
PROPERTY
public static int PROPERTY -
EXPLICIT
public static int EXPLICIT -
MIXED
public static int MIXED
-
-
Constructor Details
-
AccessCode
public AccessCode()
-
-
Method Details
-
isValidClassCode
public static boolean isValidClassCode(int code) Affirms if the given code is valid. -
isValidFieldCode
public static boolean isValidFieldCode(int code) -
isMixed
public static boolean isMixed(int code) Affirms if the given code designates that members can use both FIELD and PROPERTY based access. -
isExplicit
public static boolean isExplicit(int code) -
isProperty
public static boolean isProperty(int code) -
isField
public static boolean isField(int code) -
isUnknown
public static boolean isUnknown(int code) -
isEmpty
public static boolean isEmpty(int code) -
isField
-
isProperty
-
isUnknown
-
isEmpty
-
isField
-
isProperty
-
isUnknown
-
isCompatibleSuper
public static boolean isCompatibleSuper(int subCode, int superCode) Affirms if the sub class access type is compatible with super class access style. -
mergeFieldCode
-
mergeFieldCode
public static int mergeFieldCode(int cCode, int fCode) Merges the field access type with the class access type provided such merge is valid.- Returns:
- the modified class access code.
- Throws:
IllegalStateException- if the given codes are not compatible
-
getMixedCode
public static int getMixedCode(int cCode, int fCode) -
toFieldCode
public static int toFieldCode(int code) -
toFieldString
-
toClassString
-