类 PropertiesConverter


  • public final class PropertiesConverter
    extends java.lang.Object
    Utility to convert a Properties object to a String and back. Ideally this utility should have been used to convert to string in order to convert that string back to a Properties Object. Attempting to convert a string obtained by calling Properties.toString() will return an invalid Properties object. The format of Properties is that used by PropertiesPersister from the Spring Core, so a String in the correct format for a Spring property editor is fine (key=value pairs separated by new lines).
    作者:
    Lucas Ward, Dave Syer
    另请参阅:
    PropertiesPersister
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型方法说明
      static java.lang.StringpropertiesToString​(java.util.Properties propertiesToParse)
      Convert Properties object to String.
      static java.util.PropertiesstringToProperties​(java.lang.String stringToParse)
      Parse a String to a Properties object.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • stringToProperties

        public static java.util.Properties stringToProperties​(java.lang.String stringToParse)
        Parse a String to a Properties object. If string is null, an empty Properties object will be returned. The input String is a set of name=value pairs, delimited by either newline or comma (for brevity). If the input String contains a newline it is assumed that the separator is newline, otherwise comma.
        参数:
        stringToParse - String to parse.
        返回:
        Properties parsed from each string.
        另请参阅:
        PropertiesPersister
      • propertiesToString

        public static java.lang.String propertiesToString​(java.util.Properties propertiesToParse)
        Convert Properties object to String. This is only necessary for compatibility with converting the String back to a properties object. If an empty properties object is passed in, a blank string is returned, otherwise it's string representation is returned.
        参数:
        propertiesToParse - contains the properties be converted.
        返回:
        String representation of properties object