|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.util.Property
public class Property
Property class managing a managed value. This class managed the method invocation, field injection and constructor injection.
Field Summary | |
---|---|
static Object |
NO_VALUE
Object used for an unvalued property. |
Constructor Summary | |
---|---|
Property(String name,
String field,
String method,
int index,
String value,
String type,
InstanceManager manager,
Handler handler)
|
|
Property(String name,
String field,
String method,
String value,
String type,
InstanceManager manager,
Handler handler)
Creates a property. |
Method Summary | |
---|---|
static Class |
computeType(String type,
BundleContext context)
Computes and returns the property type according to the given type name. |
static Object |
create(Class type,
String strValue)
Creates an object of the given type with the given String value. |
static Object |
createArrayObject(Class interntype,
String[] values)
Creates an array object containing the type component type from the String array 'values'. |
Object |
getConstructorParameter(int index)
Gets the object to inject as constructor parameter. |
Class |
getConstructorParameterType(int index)
Gets the type of the constructor parameter to inject. |
String |
getField()
|
Handler |
getHandler()
Gets the handler managing the property. |
String |
getMethod()
Gets the method name, null if no method. |
String |
getName()
|
int |
getParameterIndex()
Gets the parameter index. |
String |
getType()
|
Object |
getValue()
|
boolean |
hasField()
Checks if the property has a field. |
boolean |
hasMethod()
Checks if the property has a method callback. |
void |
invoke(Object instance)
Invokes the setter method on the given pojo object. |
static boolean |
isAssignable(Class type,
Object value)
Checks if the given value is assignable to the given type. |
Object |
onGet(Object pojo,
String fieldName,
Object value)
A field value is required by the object 'pojo'. |
void |
onSet(Object pojo,
String fieldName,
Object value)
The field 'field' receives a new value. |
void |
reset()
Clears the invoked flag. |
void |
setValue(Object value)
Sets the value of the property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object NO_VALUE
Constructor Detail |
---|
public Property(String name, String field, String method, String value, String type, InstanceManager manager, Handler handler) throws ConfigurationException
name
- the name of the property (optional)field
- the name of the fieldmethod
- the method namevalue
- the initial value of the property (optional)type
- the the type of the propertymanager
- the instance managerhandler
- the handler object which manage this property.
ConfigurationException
- if the property value cannot be set.public Property(String name, String field, String method, int index, String value, String type, InstanceManager manager, Handler handler) throws ConfigurationException
ConfigurationException
Method Detail |
---|
public static Class computeType(String type, BundleContext context) throws ConfigurationException
type
- the the type namecontext
- the bundle context (used to load classes)
ConfigurationException
- if an error occurs when loading the type class for non-primitive types.public String getName()
public String getField()
public String getType()
public String getMethod()
null
if no method.
public boolean hasMethod()
true
if the property has a method.public int getParameterIndex()
-1
if this property is not injected using constructor
parameter.public boolean hasField()
true
if the property has a field.public Object getValue()
public void setValue(Object value)
value
- the new value.public static boolean isAssignable(Class type, Object value)
type
- the class of the typevalue
- the object to check
true
if the object is assignable in the property of type 'type'.public static Object create(Class type, String strValue) throws ConfigurationException
type
- the type of the returned objectstrValue
- the String value.
ConfigurationException
- if the object cannot be created.public static Object createArrayObject(Class interntype, String[] values) throws ConfigurationException
interntype
- the internal type of the array.values
- the String array
ConfigurationException
- if the array cannot be created correctlypublic void reset()
public void invoke(Object instance)
instance
- the created object (could be null
)org.apache.felix.ipojo.Handler#onCreation(java.lang.Object)
public Object onGet(Object pojo, String fieldName, Object value)
onGet
in interface FieldInterceptor
pojo
- the POJO objectfieldName
- the fieldvalue
- the last value
FieldInterceptor.onGet(java.lang.Object, java.lang.String, java.lang.Object)
public void onSet(Object pojo, String fieldName, Object value)
onSet
in interface FieldInterceptor
pojo
- the pojofieldName
- the field namevalue
- the new valueFieldInterceptor.onSet(java.lang.Object, java.lang.String, java.lang.Object)
public Object getConstructorParameter(int index)
getConstructorParameter
in interface ConstructorInjector
index
- the constructor parameter index
ConstructorInjector.getConstructorParameter(int)
public Class getConstructorParameterType(int index)
getConstructorParameterType
in interface ConstructorInjector
index
- the parameter index
ConstructorInjector.getConstructorParameterType(int)
public Handler getHandler()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |