org.apache.tapestry.enhance
Class EnhanceUtils
java.lang.Object
|
+--org.apache.tapestry.enhance.EnhanceUtils
- public class EnhanceUtils
- extends java.lang.Object
Convienience methods needed by various parts of the enhancement subsystem.
- Since:
- 3.1
- Author:
- Howard M. Lewis Ship
Method Summary |
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)
|
static void |
createSimpleMutator(EnhancementOperation op,
java.lang.String fieldName,
java.lang.String propertyName,
java.lang.Class propertyType)
|
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FINISH_LOAD_SIGNATURE
public static final org.apache.hivemind.service.MethodSignature FINISH_LOAD_SIGNATURE
PAGE_DETACHED_SIGNATURE
public static final org.apache.hivemind.service.MethodSignature PAGE_DETACHED_SIGNATURE
CLEANUP_AFTER_RENDER_SIGNATURE
public static final org.apache.hivemind.service.MethodSignature CLEANUP_AFTER_RENDER_SIGNATURE
EnhanceUtils
public EnhanceUtils()
createMutatorMethodName
public static java.lang.String createMutatorMethodName(java.lang.String propertyName)
createAccessorMethodName
public static java.lang.String createAccessorMethodName(java.lang.String propertyName)
createSimpleAccessor
public static void createSimpleAccessor(EnhancementOperation op,
java.lang.String fieldName,
java.lang.String propertyName,
java.lang.Class propertyType)
createSimpleMutator
public static void createSimpleMutator(EnhancementOperation op,
java.lang.String fieldName,
java.lang.String propertyName,
java.lang.Class propertyType)
extractPropertyType
public 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. If a type name is
non-null, then it is converted to a Class. If the class being enhanced defines a property,
then the type must be an exact match (this is largely a holdover from Tapestry 3.0, where the
type had to be provided in the specification). If the type name is null, then the value
returned is the type of the existing property (if such a property exists), or
java.lang.Object is no property exists.
- Parameters:
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.
toBoolean
public static boolean toBoolean(IBinding binding)
toByte
public static byte toByte(IBinding binding)
toChar
public static char toChar(IBinding binding)
toShort
public static short toShort(IBinding binding)
toInt
public static int toInt(IBinding binding)
toLong
public static long toLong(IBinding binding)
toFloat
public static float toFloat(IBinding binding)
toDouble
public static double toDouble(IBinding binding)
getUnwrapperMethodName
public 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. Returns null if the type is not a primitve.
createUnwrapExpression
public 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).
- Parameters:
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.