站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

StringPropertyReplacer (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class StringPropertyReplacer

java.lang.Object
  extended byorg.jboss.util.StringPropertyReplacer

public final class StringPropertyReplacer
extends Object

A utility class for replacing properties in strings.

Version:
$Revision: 1.2.6.1 $
Author:
Jason Dillon, Scott Stark, Claudio Vesco, Adrian Brock

Field Summary
static String NEWLINE
          New line string constant
 
Constructor Summary
StringPropertyReplacer()
           
 
Method Summary
static String replaceProperties(String string)
          Go through the input string and replace any occurance of ${p} with the System.getProperty(p) value.
static String replaceProperties(String string, Properties props)
          Go through the input string and replace any occurance of ${p} with the System.getProperty(p) value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

public static final String NEWLINE
New line string constant

Constructor Detail

StringPropertyReplacer

public StringPropertyReplacer()
Method Detail

replaceProperties

public static String replaceProperties(String string)
Go through the input string and replace any occurance of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with system.getProperty("path.separator").

Parameters:
string - - the string with possible ${} references
Returns:
the input string with all property references replaced if any. If there are no valid references the input string will be returned.

replaceProperties

public static String replaceProperties(String string,
                                       Properties props)
Go through the input string and replace any occurance of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with system.getProperty("path.separator").

Parameters:
string - - the string with possible ${} references
props - - the source for ${x} property ref values
Returns:
the input string with all property references replaced if any. If there are no valid references the input string will be returned.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.