public class ImmutablePropertyUtils
extends Object
Utility methods for immutable-property analysis and code generation.
| Modifiers | Name | Description |
|---|---|---|
static ClassNode |
IMMUTABLE_OPTIONS_TYPE |
The ImmutableOptions annotation type used to configure immutable-property handling. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static boolean |
builtinOrMarkedImmutableClass(Class<?> clazz)Checks whether the supplied class is built in as immutable or carries an immutable marker annotation. |
|
public static Expression |
cloneArrayOrCloneableExpr(Expression expr, ClassNode type)Creates an expression that clones an array or Cloneable value and casts it back to the requested type. |
|
public static Expression |
cloneDateExpr(Expression origDate)Creates an expression that clones a Date value. |
|
public static String |
createErrorMessage(String className, String fieldName, String typeName, String mode)Creates the standard error message for an unsupported immutable property type. |
|
public static boolean |
derivesFromDate(ClassNode fieldType)Checks whether the supplied type derives from Date. |
|
public static List<String> |
getKnownImmutableClasses(AbstractASTTransformation xform, ClassNode cNode)Extracts configured immutable helper classes from ImmutableOptions. |
|
public static List<String> |
getKnownImmutables(AbstractASTTransformation xform, ClassNode cNode)Extracts configured immutable property names from ImmutableOptions. |
|
public static boolean |
implementsCloneable(ClassNode fieldType)Checks whether the supplied type implements Cloneable. |
|
public static boolean |
isBuiltinImmutable(String typeName)Checks whether the supplied type name is one of the built-in immutable types. |
|
public static boolean |
isKnownImmutableType(ClassNode fieldType, List<String> knownImmutableClasses)Checks whether the supplied type is acceptable for an immutable property. |
The ImmutableOptions annotation type used to configure immutable-property handling.
Checks whether the supplied class is built in as immutable or carries an immutable marker annotation.
clazz - the class to inspecttrue if the class is treated as immutableCreates an expression that clones an array or Cloneable value and casts it back to the requested type.
expr - the expression producing the original valuetype - the expected result typeCreates an expression that clones a Date value.
origDate - the date expression to cloneCreates the standard error message for an unsupported immutable property type.
className - the immutable class being processedfieldName - the property nametypeName - the unsupported type namemode - the operation being performedChecks whether the supplied type derives from Date.
fieldType - the type to inspecttrue if the type derives from DateExtracts configured immutable helper classes from ImmutableOptions.
xform - the transform reporting configuration errorscNode - the annotated class nodeExtracts configured immutable property names from ImmutableOptions.
xform - the transform reporting configuration errorscNode - the annotated class nodeChecks whether the supplied type implements Cloneable.
fieldType - the type to inspecttrue if the type implements CloneableChecks whether the supplied type name is one of the built-in immutable types.
typeName - the type name to inspecttrue if the type is treated as built-in immutableChecks whether the supplied type is acceptable for an immutable property.
fieldType - the type to inspectknownImmutableClasses - additional immutable type names supplied by configurationtrue if the type is supported by immutable-property handling