Class IntrospectionHelper


  • public class IntrospectionHelper
    extends Object
    Helper class for introspection.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • PROPERTY_CHECK_CACHE

        protected static Map<String,​Boolean> PROPERTY_CHECK_CACHE
        the cache for "has property" checks.
    • Constructor Detail

      • IntrospectionHelper

        public IntrospectionHelper()
    • Method Detail

      • introspect

        public static IntrospectionHelper.IntrospectionContainer introspect​(Object obj,
                                                                            boolean useBlacklist,
                                                                            UserMode userMode)
                                                                     throws Exception
        Introspects the specified object.
        Parameters:
        obj - the object to introspect
        useBlacklist - whether to apply the GOE blacklist
        userMode - the user mode to use
        Returns:
        the information gathered
        Throws:
        Exception - if introspection fails
      • hasProperty

        public static boolean hasProperty​(Class cls,
                                          String name,
                                          Class type,
                                          UserMode userMode)
        Checks whether the class has a property with the given name and type.
        Parameters:
        cls - the class to inspect
        name - the name of the property to look for
        type - the type that the property must have, can be null
        userMode - the user mode to apply
        Returns:
        true if the class has that property
      • hasProperty

        public static boolean hasProperty​(Class cls,
                                          String name,
                                          Class type,
                                          boolean useBlacklist,
                                          UserMode userMode)
        Checks whether the class has a property with the given name and type.
        Parameters:
        cls - the class to inspect
        name - the name of the property to look for
        type - the type that the property must have, can be null
        useBlacklist - whether to apply the blacklist
        userMode - the user mode to apply
        Returns:
        true if the class has that property