Class PropertiesConverter

java.lang.Object
org.springframework.batch.support.PropertiesConverter

public final class PropertiesConverter extends Object
Utility to convert a Properties object to a String and back. The format of properties is new line separated key=value pairs.
Author:
Lucas Ward, Dave Syer, Mahmoud Ben Hassine
  • Method Details

    • stringToProperties

      public static Properties stringToProperties(@NonNull String stringToParse)
      Parse a String to a Properties object. If string is empty, an empty Properties object will be returned. The input String should be a set of key=value pairs, separated by a new line.
      Parameters:
      stringToParse - String to parse. Must not be null.
      Returns:
      Properties parsed from each key=value pair.
    • propertiesToString

      public static String propertiesToString(@NonNull Properties propertiesToParse)
      Convert a Properties object to a 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.
      Parameters:
      propertiesToParse - contains the properties to be converted. Must not be null.
      Returns:
      String representation of the properties object