com.springsource.util.common
Class PropertyPlaceholderResolver

java.lang.Object
  extended by com.springsource.util.common.PropertyPlaceholderResolver

public final class PropertyPlaceholderResolver
extends java.lang.Object

Utility class for resolving placeholders inside a Properties instance. These placeholders can refer to other properties in the Properties instance. The place holders may also have a modifier in them

 ${com.springsource:modifier}
 
where everything after the colon is considered the modifier. This class does not interpret these modifiers but rather delegates to a PropertyPlaceholderResolver.PlaceholderValueTransformer for processing.

Concurrent Semantics
Threadsafe.


Nested Class Summary
static interface PropertyPlaceholderResolver.PlaceholderValueTransformer
          An interface for property placeholder modifiers.
 
Field Summary
private static PropertyPlaceholderResolver.PlaceholderValueTransformer IDENTITY_TRANSFORMER
           
private static java.util.regex.Pattern PATTERN
           
 
Constructor Summary
PropertyPlaceholderResolver()
           
 
Method Summary
private static java.lang.String escapeBackslashes(java.lang.String string)
           
private  java.lang.String formatPropertyCycleMessage(java.util.Stack<java.lang.String> visitState)
           
 java.util.Properties resolve(java.util.Properties input)
          Resolves all placeholders in the supplied Properties instance.
 java.util.Properties resolve(java.util.Properties input, PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)
          Resolves all placeholders in the supplied Properties instance and transform any based on their modifiers.
 java.lang.String resolve(java.lang.String input, java.util.Properties props)
          Resolves all placeholders in the supplied string with values from a Properties instance.
 java.lang.String resolve(java.lang.String input, java.util.Properties props, PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)
          Resolves all placeholders in the supplied string with values from a Properties instance and transform any based on their modifiers.
private  java.lang.String resolve(java.lang.String name, java.util.Properties props, PropertyPlaceholderResolver.PlaceholderValueTransformer transformer, java.util.Stack<java.lang.String> visitState)
           
private  java.lang.String resolveProperty(java.lang.String name, java.util.Properties props, PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN

private static final java.util.regex.Pattern PATTERN

IDENTITY_TRANSFORMER

private static final PropertyPlaceholderResolver.PlaceholderValueTransformer IDENTITY_TRANSFORMER
Constructor Detail

PropertyPlaceholderResolver

public PropertyPlaceholderResolver()
Method Detail

resolve

public java.util.Properties resolve(java.util.Properties input)
Resolves all placeholders in the supplied Properties instance.

Parameters:
input - the properties to resolve.
Returns:
the resolved properties.

resolve

public java.util.Properties resolve(java.util.Properties input,
                                    PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)
Resolves all placeholders in the supplied Properties instance and transform any based on their modifiers.

Parameters:
input - the properties to resolve.
transformer - a transformer for handling property modifiers
Returns:
the resolved properties.

resolve

public java.lang.String resolve(java.lang.String input,
                                java.util.Properties props)
Resolves all placeholders in the supplied string with values from a Properties instance.

Parameters:
input - the string to resolve
props - the properties to use for resolution
Returns:
the resolved string

resolve

public java.lang.String resolve(java.lang.String input,
                                java.util.Properties props,
                                PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)
Resolves all placeholders in the supplied string with values from a Properties instance and transform any based on their modifiers.

Parameters:
input - the string to resolve
props - the properties to use for resolution
transformer - a transformer for handling property modifiers
Returns:
the resolved string

resolveProperty

private java.lang.String resolveProperty(java.lang.String name,
                                         java.util.Properties props,
                                         PropertyPlaceholderResolver.PlaceholderValueTransformer transformer)

resolve

private java.lang.String resolve(java.lang.String name,
                                 java.util.Properties props,
                                 PropertyPlaceholderResolver.PlaceholderValueTransformer transformer,
                                 java.util.Stack<java.lang.String> visitState)

escapeBackslashes

private static java.lang.String escapeBackslashes(java.lang.String string)

formatPropertyCycleMessage

private java.lang.String formatPropertyCycleMessage(java.util.Stack<java.lang.String> visitState)