|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.planetalia.dynject.injection.Shell
public class Shell
The Shell class represents the processed configuration for all annotated fields and methods of a class whose instances will be subject to injection/validation. Usually all instances of a class share the same shell to avoid processing delays and memory impact
| Method Summary | ||
|---|---|---|
void |
addProperty(Property property)
Adds a new property with an empty data path. |
|
static ErrorMap |
assign(java.lang.Object instance,
Environment env,
IValueSource valueProvider)
Convenience method that performs an assignment of a source of values to an instance, making all conversions and validations along the way. |
|
static
|
assign(java.lang.Object instance,
Environment env,
java.util.Map<java.lang.String,T> values)
Convenience method that performs an assignment of a map of values to an instance, making all conversions and validations along the way. |
|
static ErrorMap |
assign(java.lang.Object instance,
IValueSource valueProvider)
Convenience method that performs an assignment of a map of values to an instance, making all conversions and validations along the way. |
|
static
|
assign(java.lang.Object instance,
java.util.Map<java.lang.String,T> values)
Convenience method that performs an assignment of a map of values to an instance, making all conversions and validations along the way. |
|
static ErrorMap |
assign(java.lang.Object instance,
java.lang.String name,
Environment env,
java.lang.Object sourceValue)
Convenience method to assign a value to a single property |
|
static ErrorMap |
assign(java.lang.Object instance,
java.lang.String name,
java.lang.Object sourceValue)
Convenience method to assign a value to a single property |
|
void |
dump(java.io.PrintStream out)
Dumps (for debugging purposes) the configurtion of this shell |
|
DataPath |
getClasswideDataPath()
Returns the data path applicable to all properties of this class |
|
DataPath |
getDataPathFor(java.lang.String propertyName)
Returns the data path of a specific property |
|
Property |
getProperty(java.lang.String name)
Returns the property information associated with a specific property |
|
java.util.Set<java.lang.String> |
getPropertyNames()
Returns the property names registered with this shell |
|
static Shell |
getShell(java.lang.Class clazz)
Returns the injection shell for a specified class. |
|
static Shell |
getShell(java.lang.Object o)
Returns the injection shell for a specified object. |
|
ErrorMap |
performAssignment(boolean setFinalValue,
java.lang.Object instance,
Environment env,
IValueSource valueProvider)
Peforms an object-wide assignment of all properties. |
|
ErrorMap |
performSingleAssignment(java.lang.Object instance,
java.lang.String name,
Environment env,
java.lang.Object sourceValue)
Performs a single property assignment |
|
static void |
registerBinder(IClassBinder binder)
Registers a new extension for the binding process |
|
void |
removeProperty(Property property)
Removes a property from the shell. |
|
void |
setClasswideDataPath(DataPath classwideDataPath)
Sets the data path applicable to all properties of this class |
|
static boolean |
unregisterBinder(IClassBinder binder)
Removes a new extension for the binding process |
|
static ErrorMap |
validate(Environment env,
java.lang.Object instance)
Performs a validation of the data in the current instance |
|
static ErrorMap |
validate(java.lang.Object instance)
Performs a validation of the data in the current instance |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public DataPath getDataPathFor(java.lang.String propertyName)
propertyName - Property name
public void addProperty(Property property)
property - Property to addpublic void removeProperty(Property property)
property - Property to be removedpublic static void registerBinder(IClassBinder binder)
binder - Instance that will participate in the binding processpublic static boolean unregisterBinder(IClassBinder binder)
binder - Instance that will be removed binding process
public void dump(java.io.PrintStream out)
out - Stream where to dump the shell
public ErrorMap performAssignment(boolean setFinalValue,
java.lang.Object instance,
Environment env,
IValueSource valueProvider)
setFinalValue - Specifies whether to assign the final values resulting from the datapath to the
properties (if set to true), or whether only to perform validation of the values and nothing more (if set to false)instance - Instace holding the properties to assignenv - EnvironmentvalueProvider - Provider of property values
public ErrorMap performSingleAssignment(java.lang.Object instance,
java.lang.String name,
Environment env,
java.lang.Object sourceValue)
instance - Instance holding the propertyname - Name of the property to assignenv - EnvironmentsourceValue - Value to assign
public static Shell getShell(java.lang.Class clazz)
clazz - The class for which to fetch the injection shell. It must be non-null.
public static Shell getShell(java.lang.Object o)
o - The object for which to fetch the injection shell. It must be non-null.
public static ErrorMap assign(java.lang.Object instance,
Environment env,
IValueSource valueProvider)
instance - Instance to assign the values to.env - Environment to usevalueProvider - Provider of property values
public static <T> ErrorMap assign(java.lang.Object instance,
Environment env,
java.util.Map<java.lang.String,T> values)
T - Type of the properties that will be provided by the map sourceinstance - Instance to assign the values to.env - Environment to usevalues - Map containing the values of the properties
public static ErrorMap assign(java.lang.Object instance,
IValueSource valueProvider)
instance - Instance to assign the values to.valueProvider - Provider of property values
public static <T> ErrorMap assign(java.lang.Object instance,
java.util.Map<java.lang.String,T> values)
T - Type of the properties that will be provided by the map sourceinstance - Instance to assign the values to.values - Map containing the values of the properties
public static ErrorMap assign(java.lang.Object instance,
java.lang.String name,
Environment env,
java.lang.Object sourceValue)
instance - Instance holding the propertyname - Property nameenv - Environment to usesourceValue - Value to assign
public static ErrorMap assign(java.lang.Object instance,
java.lang.String name,
java.lang.Object sourceValue)
instance - Instance holding the propertyname - Property namesourceValue - Value to assign
public DataPath getClasswideDataPath()
public void setClasswideDataPath(DataPath classwideDataPath)
classwideDataPath - data path applicable to all properties of this classpublic static ErrorMap validate(java.lang.Object instance)
instance - Instance to validate
public static ErrorMap validate(Environment env,
java.lang.Object instance)
env - Runtime environment to useinstance - Instance to validate
public Property getProperty(java.lang.String name)
name - Property name
public java.util.Set<java.lang.String> getPropertyNames()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||