Class ConfigParser


  • public class ConfigParser
    extends java.lang.Object
    Parses the configuration data associated with classes that contain setter properties. The format of the property string should be like:
       MyClass{{propertyOne=foo}{propertyTwo=bar}}
     
    Version:
    $Revision: 1501 $ $Date: 2010-08-18 20:48:01 +0200 (Wed, 18 Aug 2010) $
    Author:
    Middleware Services
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigParser​(java.lang.String config)
      Creates a new ConfigParser with the supplied configuration string.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getClassName()
      Returns the class name from the configuration.
      java.util.Map<java.lang.String,​java.lang.String> getProperties()
      Returns the properties from the configuration.
      java.lang.Object initializeType()
      Initialize an instance of the class type with the properties contained in this config.
      static boolean isConfig​(java.lang.String config)
      Returns whether the supplied configuration data contains a config.
      protected void setProperties​(java.lang.Class<?> c, java.lang.Object o)
      Sets the properties on the supplied object.
      • Methods inherited from class java.lang.Object

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

      • ConfigParser

        public ConfigParser​(java.lang.String config)
        Creates a new ConfigParser with the supplied configuration string.
        Parameters:
        config - String
    • Method Detail

      • getClassName

        public java.lang.String getClassName()
        Returns the class name from the configuration.
        Returns:
        String class name
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.String> getProperties()
        Returns the properties from the configuration.
        Returns:
        Map of property name to value
      • isConfig

        public static boolean isConfig​(java.lang.String config)
        Returns whether the supplied configuration data contains a config.
        Parameters:
        config - String
        Returns:
        boolean
      • initializeType

        public java.lang.Object initializeType()
        Initialize an instance of the class type with the properties contained in this config.
        Returns:
        Object of the type the config parsed
      • setProperties

        protected void setProperties​(java.lang.Class<?> c,
                                     java.lang.Object o)
        Sets the properties on the supplied object.
        Parameters:
        c - Class type of the supplied object
        o - Object to invoke properties on