Class AbstractObjectHandler<T>

    • Field Detail

      • m_Handlers

        protected static HashMap<Class,​Class> m_Handlers
        the cache for object class/object handler relation.
      • m_NoHandlers

        protected static HashSet<Class> m_NoHandlers
        the cache for object classes without object handlers.
    • Constructor Detail

      • AbstractObjectHandler

        public AbstractObjectHandler()
    • Method Detail

      • handles

        public boolean handles​(Object obj)
        Checks whether the handler can process the given object.
        Parameters:
        obj - the object to check
        Returns:
        true if handler can process the object
        See Also:
        handles(Class)
      • handles

        public abstract boolean handles​(Class cls)
        Checks whether the handler can process the given class.
        Parameters:
        cls - the class to check
        Returns:
        true if handler can process the class
      • parse

        public abstract T parse​(String s)
        Parses the given string.
        Parameters:
        s - the string
        Returns:
        the generated object, null if failed to convert
      • format

        public abstract String format​(T obj)
        Turns the given object back into a string.
        Parameters:
        obj - the object to convert into a string
        Returns:
        the string representation
      • getHandler

        public static AbstractObjectHandler getHandler​(Object obj)
        Returns the handler for the specific object.
        Parameters:
        obj - the object to get the handler for
        Returns:
        the handler class or null if none available
      • getHandler

        public static AbstractObjectHandler getHandler​(Class cls)
        Returns the handler for the specific object class.
        Parameters:
        cls - the class to get the handler for
        Returns:
        the handler or null if none available
      • getHandlers

        public static String[] getHandlers()
        Returns a list with classnames of handlers.
        Returns:
        the handler classnames