Class BeanInfoUtil


  • public class BeanInfoUtil
    extends Object
    • Field Detail

      • SCRIPT_VISIBILITY_MODIFIERS

        public static final String SCRIPT_VISIBILITY_MODIFIERS
        A FeatureDescriptor value indicating its visibility to Gosu
        See Also:
        Constant Field Values
      • EMPTY_CLASS_ARRAY

        protected static final Class[] EMPTY_CLASS_ARRAY
        To save allocations.
      • EMPTY_STRING_ARRAY

        protected static final String[] EMPTY_STRING_ARRAY
    • Constructor Detail

      • BeanInfoUtil

        public BeanInfoUtil()
    • Method Detail

      • buildScriptableMethodDescriptorNoArgs

        public static MethodDescriptor buildScriptableMethodDescriptorNoArgs​(Class actionClass,
                                                                             String methodName)
        Builds a no-arg method descriptor that is exposed for scripting everywhere.
      • buildScriptableMethodDescriptor

        public static MethodDescriptor buildScriptableMethodDescriptor​(Class actionClass,
                                                                       String methodName,
                                                                       String[] parameterNames,
                                                                       Class[] parameterTypes)
        Builds a method descriptor that is exposed for scripting everywhere.
      • buildScriptableDeprecatedMethodDescriptor

        public static MethodDescriptor buildScriptableDeprecatedMethodDescriptor​(Class actionClass,
                                                                                 String methodName,
                                                                                 String[] parameterNames,
                                                                                 Class[] parameterTypes)
        Builds a deprecated method descriptor that is exposed for scripting everywhere.
      • buildHiddenMethodDescriptor

        public static MethodDescriptor buildHiddenMethodDescriptor​(Class actionClass,
                                                                   String methodName,
                                                                   String[] parameterNames,
                                                                   Class[] parameterTypes)
        Completely hides a method from scripting.
      • buildMethodDescriptor

        public static MethodDescriptor buildMethodDescriptor​(Class actionClass,
                                                             String methodName,
                                                             String[] parameterNames,
                                                             Class[] parameterTypes)
        Deprecated.
        To properly expose a method for scripting call buildScriptableMethodDescriptor() or a derivative of that.
      • buildScriptablePropertyDescriptor

        public static TypedPropertyDescriptor buildScriptablePropertyDescriptor​(String propertyName,
                                                                                Class beanClass,
                                                                                String getterName,
                                                                                String setterName)
        Builds a scriptable property descriptor with the given information.
        Parameters:
        propertyName - name of the property
        beanClass - class of the bean on which the property is found
        getterName - name of the getter method, or null if write-only
        propertyName - name of the setter method, or null if read-only
      • makeScriptable

        public static FeatureDescriptor makeScriptable​(FeatureDescriptor descriptor)
        Expose the method/property descriptor for scripting.
        Parameters:
        descriptor - A method or property descriptor.
        Returns:
        The same descriptor.
      • makeScriptableDeprecated

        public static FeatureDescriptor makeScriptableDeprecated​(FeatureDescriptor descriptor)
        Expose the method/property descriptor for scripting, but mark it deprecated.
        Parameters:
        descriptor - A method or property descriptor.
        Returns:
        The same descriptor.
      • isScriptable

        public static boolean isScriptable​(FeatureDescriptor descriptor)
        Returns:
        True if the descriptor is exposed for scripting.
      • isDeprecated

        public static boolean isDeprecated​(FeatureDescriptor descriptor)
        Returns:
        True if the descriptor is deprecated.
      • getVisibilityModifier

        public static IScriptabilityModifier getVisibilityModifier​(FeatureDescriptor descriptor)
        Parameters:
        descriptor - A method or property descriptor.
        Returns:
        The descriptor's associated visibility modifier.
      • setVisibilityModifier

        public static void setVisibilityModifier​(FeatureDescriptor descriptor,
                                                 IScriptabilityModifier modifier)
        Parameters:
        descriptor - A method or property descriptor.
        modifier - The descriptor's associated visibility modifier.
      • _buildMethodDescriptor

        protected static MethodDescriptor _buildMethodDescriptor​(Class actionClass,
                                                                 String methodName,
                                                                 String[] parameterNames,
                                                                 Class[] parameterTypes,
                                                                 Class[] actualParameterTypes)
        Builds a method descriptor with no explicit visibility.
      • _buildPropertyDescriptor

        protected static TypedPropertyDescriptor _buildPropertyDescriptor​(String propertyName,
                                                                          Class beanClass,
                                                                          String getterName,
                                                                          String setterName)
        Builds a property descriptor with no explicit visibility.