Class BeanUtilities
- java.lang.Object
-
- org.glassfish.hk2.configuration.internal.BeanUtilities
-
public class BeanUtilities extends Object
For JavaBean or Bean-Like-Map utilities- Author:
- jwells
-
-
Constructor Summary
Constructors Constructor Description BeanUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
getBeanPropertyValue(Type requiredType, String attribute, BeanInfo beanInfo)
Gets the value from the given attribute from the given bean Safe to give both a bean-like map and a java beanstatic String
getParameterNameFromField(Field f, boolean onlyDynamic)
Gets the parameter name from a fieldstatic String
getParameterNameFromMethod(Method m, int paramIndex)
static boolean
hasDynamicParameter(Method m)
static boolean
isEmpty(String s)
-
-
-
Method Detail
-
getBeanPropertyValue
public static Object getBeanPropertyValue(Type requiredType, String attribute, BeanInfo beanInfo)
Gets the value from the given attribute from the given bean Safe to give both a bean-like map and a java bean- Parameters:
requiredType
- the type the attribute must beattribute
- the attribute to get. The bean must have a method with the name format getAttributebeanInfo
- the bean info- Returns:
- the value of the attribute
- Throws:
IllegalStateException
- if unable to get the attribute
-
isEmpty
public static boolean isEmpty(String s)
-
getParameterNameFromField
public static String getParameterNameFromField(Field f, boolean onlyDynamic)
Gets the parameter name from a field- Parameters:
f
- the field annotated withConfigured
onlyDynamic
- if true and theConfigured
annotation is notDynamicity.FULLY_DYNAMIC
the null will be returned- Returns:
- the value of the
Configured
annotation if non-empty or the name of the field otherwise
-
getParameterNameFromMethod
public static String getParameterNameFromMethod(Method m, int paramIndex)
-
hasDynamicParameter
public static boolean hasDynamicParameter(Method m)
-
-