Class BeanUtilities


  • public class BeanUtilities
    extends java.lang.Object
    For JavaBean or Bean-Like-Map utilities
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String EMPTY  
      private static java.lang.String GET  
      private static java.lang.String IS  
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String firstUpper​(java.lang.String s)  
      static java.lang.Object getBeanPropertyValue​(java.lang.reflect.Type requiredType, java.lang.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
      static java.lang.String getParameterNameFromField​(java.lang.reflect.Field f, boolean onlyDynamic)
      Gets the parameter name from a field
      static java.lang.String getParameterNameFromMethod​(java.lang.reflect.Method m, int paramIndex)  
      static boolean hasDynamicParameter​(java.lang.reflect.Method m)  
      static boolean isEmpty​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BeanUtilities

        public BeanUtilities()
    • Method Detail

      • firstUpper

        private static java.lang.String firstUpper​(java.lang.String s)
      • getBeanPropertyValue

        public static java.lang.Object getBeanPropertyValue​(java.lang.reflect.Type requiredType,
                                                            java.lang.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 be
        attribute - the attribute to get. The bean must have a method with the name format getAttribute
        beanInfo - the bean info
        Returns:
        the value of the attribute
        Throws:
        java.lang.IllegalStateException - if unable to get the attribute
      • isEmpty

        public static boolean isEmpty​(java.lang.String s)
      • getParameterNameFromField

        public static java.lang.String getParameterNameFromField​(java.lang.reflect.Field f,
                                                                 boolean onlyDynamic)
        Gets the parameter name from a field
        Parameters:
        f - the field annotated with Configured
        onlyDynamic - if true and the Configured annotation is not Dynamicity.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 java.lang.String getParameterNameFromMethod​(java.lang.reflect.Method m,
                                                                  int paramIndex)
      • hasDynamicParameter

        public static boolean hasDynamicParameter​(java.lang.reflect.Method m)