Class DescriptorManager


  • public class DescriptorManager
    extends java.lang.Object
    Generate String description of an Object from registred ElementDescriptors
    See Also:
    ElementDescriptor
    • Constructor Summary

      Constructors 
      Constructor Description
      DescriptorManager()
      Instanciate a new DecriptorManager with default formaters - descriptionDefault = "unknownElement" - descriptionNull = "null" - descriptionHeader = "" - descriptionTail = "" - propertySeparator = ", " - propertyValueSeparator = "="
      DescriptorManager​(java.lang.String descriptionDefault, java.lang.String descriptionNull, java.lang.String descriptionHeader, java.lang.String descriptionTail, java.lang.String propertySeparator, java.lang.String propertyValueSeparator)
      Instanciate a new DecriptorManager with specific formaters
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String generateDescription​(java.lang.String key, java.lang.String value)
      Generates a description related to one property key, value
      protected java.lang.String generateDescription​(java.util.Map<java.lang.String,​java.lang.String> properties)
      Generates a description based on a map (key,value) of properties
      java.lang.String getDescription​(java.lang.Object element)
      Search for the most appropriate ElementDescriptor for this element and returns the generated description
      void register​(ElementDescriptor descriptor)
      Register a new ElementDescriptor in this manager, and replace any pre-existing one handling the same class
      void register​(ElementDescriptor descriptor, boolean replace)
      Register a new ElementDescriptor in this manager
      • Methods inherited from class java.lang.Object

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

      • descriptionDefault

        protected final java.lang.String descriptionDefault
      • descriptionNull

        protected final java.lang.String descriptionNull
      • descriptionHeader

        protected final java.lang.String descriptionHeader
      • descriptionTail

        protected final java.lang.String descriptionTail
      • propertySeparator

        protected final java.lang.String propertySeparator
      • propertyValueSeparator

        protected final java.lang.String propertyValueSeparator
    • Constructor Detail

      • DescriptorManager

        public DescriptorManager​(java.lang.String descriptionDefault,
                                 java.lang.String descriptionNull,
                                 java.lang.String descriptionHeader,
                                 java.lang.String descriptionTail,
                                 java.lang.String propertySeparator,
                                 java.lang.String propertyValueSeparator)
        Instanciate a new DecriptorManager with specific formaters
        Parameters:
        descriptionDefault - Default String description of an element if no compatible ElementDescriptor found
        descriptionNull - String description for null values
        descriptionHeader - Header of a description
        descriptionTail - Tail of a description
        propertySeparator - Separator used between properties provided by an ElementDescriptor
        propertyValueSeparator - Separator between key and value of a property
      • DescriptorManager

        public DescriptorManager()
        Instanciate a new DecriptorManager with default formaters - descriptionDefault = "unknownElement" - descriptionNull = "null" - descriptionHeader = "" - descriptionTail = "" - propertySeparator = ", " - propertyValueSeparator = "="
    • Method Detail

      • register

        public void register​(ElementDescriptor descriptor,
                             boolean replace)
        Register a new ElementDescriptor in this manager
        Parameters:
        descriptor -
        replace - true if this descriptor should replace any pre-existing one handling the same class
      • register

        public void register​(ElementDescriptor descriptor)
        Register a new ElementDescriptor in this manager, and replace any pre-existing one handling the same class
        Parameters:
        descriptor -
      • getDescription

        public java.lang.String getDescription​(java.lang.Object element)
        Search for the most appropriate ElementDescriptor for this element and returns the generated description
        Parameters:
        element -
        Returns:
        the Element's description
      • generateDescription

        protected java.lang.String generateDescription​(java.util.Map<java.lang.String,​java.lang.String> properties)
        Generates a description based on a map (key,value) of properties
        Parameters:
        properties -
        Returns:
      • generateDescription

        protected java.lang.String generateDescription​(java.lang.String key,
                                                       java.lang.String value)
        Generates a description related to one property key, value
        Parameters:
        key -
        value -
        Returns: