public class EnhanceUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.hivemind.service.MethodSignature |
CLEANUP_AFTER_RENDER_SIGNATURE |
static org.apache.hivemind.service.MethodSignature |
FINISH_LOAD_SIGNATURE |
static org.apache.hivemind.service.MethodSignature |
PAGE_DETACHED_SIGNATURE |
Constructor and Description |
---|
EnhanceUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createAccessorMethodName(java.lang.String propertyName) |
static java.lang.String |
createMutatorMethodName(java.lang.String propertyName) |
static void |
createSimpleAccessor(EnhancementOperation op,
java.lang.String fieldName,
java.lang.String propertyName,
java.lang.Class propertyType,
org.apache.hivemind.Location location) |
static void |
createSimpleMutator(EnhancementOperation op,
java.lang.String fieldName,
java.lang.String propertyName,
java.lang.Class propertyType,
org.apache.hivemind.Location location) |
static java.lang.String |
createUnwrapExpression(EnhancementOperation op,
java.lang.String bindingName,
java.lang.Class valueType)
Builds a Javassist expression for unwrapping a binding's value to a type (either primitive or
a class type).
|
static java.lang.Class |
extractPropertyType(EnhancementOperation op,
java.lang.String propertyName,
java.lang.String definedTypeName)
Returns the correct class for a property to be enhanced into a class.
|
static java.lang.String |
getUnwrapperMethodName(java.lang.Class type)
Returns the name of the static method, within EnhanceUtils, used to unwrap a binding to a
primitive type.
|
static boolean |
toBoolean(IBinding binding) |
static byte |
toByte(IBinding binding) |
static char |
toChar(IBinding binding) |
static double |
toDouble(IBinding binding) |
static float |
toFloat(IBinding binding) |
static int |
toInt(IBinding binding) |
static long |
toLong(IBinding binding) |
static short |
toShort(IBinding binding) |
static java.lang.Class |
verifyPropertyType(EnhancementOperation op,
java.lang.String propertyName,
java.lang.Class requiredType)
Verifies that a property type can be assigned a particular type of value.
|
public static final org.apache.hivemind.service.MethodSignature FINISH_LOAD_SIGNATURE
public static final org.apache.hivemind.service.MethodSignature PAGE_DETACHED_SIGNATURE
public static final org.apache.hivemind.service.MethodSignature CLEANUP_AFTER_RENDER_SIGNATURE
public EnhanceUtils()
public static java.lang.String createMutatorMethodName(java.lang.String propertyName)
public static java.lang.String createAccessorMethodName(java.lang.String propertyName)
public static void createSimpleAccessor(EnhancementOperation op, java.lang.String fieldName, java.lang.String propertyName, java.lang.Class propertyType, org.apache.hivemind.Location location)
public static void createSimpleMutator(EnhancementOperation op, java.lang.String fieldName, java.lang.String propertyName, java.lang.Class propertyType, org.apache.hivemind.Location location)
public static java.lang.Class extractPropertyType(EnhancementOperation op, java.lang.String propertyName, java.lang.String definedTypeName)
op
- the enhancement operation, which provides most of this logicpropertyName
- the name of the property (the property may or may not exist)definedTypeName
- the type indicated for the property, may be null to make the return value match
the type of an existing property.public static java.lang.String getUnwrapperMethodName(java.lang.Class type)
public static java.lang.String createUnwrapExpression(EnhancementOperation op, java.lang.String bindingName, java.lang.Class valueType)
op
- the enhancement operationbindingName
- the name of the field (or an expression) that will evaluate to the binding from
which a value will be extracted.valueType
- the type of value to be extracted from the binding.public static java.lang.Class verifyPropertyType(EnhancementOperation op, java.lang.String propertyName, java.lang.Class requiredType)
op
- the enhancement operationpropertyName
- the name of the property to checkrequiredType
- the type of value that will be assigned to the property