public class Injection extends Object
com.github.fungal.api.util.Injection
class.Constructor and Description |
---|
Injection()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected Field |
findField(Class<?> clz,
String fieldName,
String fieldType)
Find a field
|
protected Method |
findMethod(Class<?> clz,
String methodName,
String propertyType)
Find a method
|
protected String |
getSubstitutionValue(String input)
System property substitution
|
protected Object |
getValue(String name,
Class<?> clz,
Object v,
ClassLoader cl)
Get the value
|
void |
inject(Object object,
String propertyName,
Object propertyValue)
Inject a value into an object property
|
void |
inject(Object object,
String propertyName,
Object propertyValue,
String propertyType)
Inject a value into an object property
|
void |
inject(Object object,
String propertyName,
Object propertyValue,
String propertyType,
boolean includeFields)
Inject a value into an object property
|
public void inject(Object object, String propertyName, Object propertyValue) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
object
- The objectpropertyName
- The property namepropertyValue
- The property valueNoSuchMethodException
- If the property method cannot be foundIllegalAccessException
- If the property method cannot be accessedInvocationTargetException
- If the property method cannot be executedpublic void inject(Object object, String propertyName, Object propertyValue, String propertyType) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
object
- The objectpropertyName
- The property namepropertyValue
- The property valuepropertyType
- The property type as a fully quilified class nameNoSuchMethodException
- If the property method cannot be foundIllegalAccessException
- If the property method cannot be accessedInvocationTargetException
- If the property method cannot be executedpublic void inject(Object object, String propertyName, Object propertyValue, String propertyType, boolean includeFields) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
object
- The objectpropertyName
- The property namepropertyValue
- The property valuepropertyType
- The property type as a fully quilified class nameincludeFields
- Should fields be included for injection if a method can't be foundNoSuchMethodException
- If the property method cannot be foundIllegalAccessException
- If the property method cannot be accessedInvocationTargetException
- If the property method cannot be executedprotected Method findMethod(Class<?> clz, String methodName, String propertyType)
clz
- The classmethodName
- The method namepropertyType
- The property type; can be null
null
if not foundprotected Field findField(Class<?> clz, String fieldName, String fieldType)
clz
- The classfieldName
- The field namefieldType
- The field type; can be null
null
if not foundprotected Object getValue(String name, Class<?> clz, Object v, ClassLoader cl) throws Exception
name
- The value nameclz
- The value classv
- The valuecl
- The class loaderException
- Thrown in case of an errorCopyright © 2017 JBoss by Red Hat. All rights reserved.