本文整理汇总了Java中org.apache.tools.ant.ProjectHelper.parsePropertyString方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectHelper.parsePropertyString方法的具体用法?Java ProjectHelper.parsePropertyString怎么用?Java ProjectHelper.parsePropertyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.ProjectHelper
的用法示例。
在下文中一共展示了ProjectHelper.parsePropertyString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveAllProperties
import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
* resolve properties inside a properties hashtable
*
* @param props properties object to resolve
* @exception BuildException Description of the Exception
*/
private void resolveAllProperties( Properties props ) throws BuildException {
for ( Enumeration e = props.keys(); e.hasMoreElements(); ) {
String name = ( String ) e.nextElement();
String value = props.getProperty( name );
boolean resolved = false;
while ( !resolved ) {
Vector fragments = new Vector();
Vector propertyRefs = new Vector();
ProjectHelper.parsePropertyString( value, fragments,
propertyRefs );
resolved = true;
if ( propertyRefs.size() != 0 ) {
StringBuffer sb = new StringBuffer();
Enumeration i = fragments.elements();
Enumeration j = propertyRefs.elements();
while ( i.hasMoreElements() ) {
String fragment = ( String ) i.nextElement();
if ( fragment == null ) {
String propertyName = ( String ) j.nextElement();
if ( propertyName.equals( name ) ) {
throw new BuildException( "Property " + name
+ " was circularly "
+ "defined." );
}
fragment = getProject().getProperty( propertyName );
if ( fragment == null ) {
if ( props.containsKey( propertyName ) ) {
fragment = props.getProperty( propertyName );
resolved = false;
}
else {
fragment = "${" + propertyName + "}";
}
}
}
sb.append( fragment );
}
value = sb.toString();
props.put( name, value );
}
}
}
}
示例2: resolveAllProperties
import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
* Borrowed from Property -- resolve properties inside a properties
* hashtable
*
* @param fileprops Description of the Parameter
* @exception BuildException Description of the Exception
*/
private void resolveAllProperties( Properties fileprops ) throws BuildException {
for ( Enumeration e = fileprops.keys(); e.hasMoreElements(); ) {
String name = ( String ) e.nextElement();
String value = fileprops.getProperty( name );
boolean resolved = false;
while ( !resolved ) {
Vector fragments = new Vector();
Vector propertyRefs = new Vector();
/// this is the Ant 1.5 way of doing it. The Ant 1.6 PropertyHelper
/// should be used -- eventually.
ProjectHelper.parsePropertyString( value, fragments,
propertyRefs );
resolved = true;
if ( propertyRefs.size() != 0 ) {
StringBuffer sb = new StringBuffer();
Enumeration i = fragments.elements();
Enumeration j = propertyRefs.elements();
while ( i.hasMoreElements() ) {
String fragment = ( String ) i.nextElement();
if ( fragment == null ) {
String propertyName = ( String ) j.nextElement();
if ( propertyName.equals( name ) ) {
throw new BuildException( "Property " + name
+ " was circularly "
+ "defined." );
}
fragment = getProject().getProperty( propertyName );
if ( fragment == null ) {
if ( fileprops.containsKey( propertyName ) ) {
fragment = fileprops.getProperty( propertyName );
resolved = false;
}
else {
fragment = "${" + propertyName + "}";
}
}
}
sb.append( fragment );
}
value = sb.toString();
fileprops.put( name, value );
}
}
}
}
示例3: resolveAllProperties
import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
* resolve properties inside a properties hashtable
*
* @param props
* properties object to resolve
* @exception BuildException
* Description of the Exception
*/
private void resolveAllProperties(Properties props) throws BuildException {
for (Enumeration e = props.keys(); e.hasMoreElements();) {
String name = (String) e.nextElement();
String value = props.getProperty(name);
boolean resolved = false;
while (!resolved) {
Vector fragments = new Vector();
Vector propertyRefs = new Vector();
ProjectHelper.parsePropertyString(value, fragments, propertyRefs);
resolved = true;
if (propertyRefs.size() != 0) {
StringBuffer sb = new StringBuffer();
Enumeration i = fragments.elements();
Enumeration j = propertyRefs.elements();
while (i.hasMoreElements()) {
String fragment = (String) i.nextElement();
if (fragment == null) {
String propertyName = (String) j.nextElement();
if (propertyName.equals(name)) {
throw new BuildException("Property " + name + " was circularly " + "defined.");
}
fragment = getProject().getProperty(propertyName);
if (fragment == null) {
if (props.containsKey(propertyName)) {
fragment = props.getProperty(propertyName);
resolved = false;
} else {
fragment = "${" + propertyName + "}";
}
}
}
sb.append(fragment);
}
value = sb.toString();
props.put(name, value);
}
}
}
}
示例4: resolveAllProperties
import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
* Borrowed from Property -- resolve properties inside a properties
* hashtable
*
* @param fileprops
* Description of the Parameter
* @exception BuildException
* Description of the Exception
*/
private void resolveAllProperties(Properties fileprops) throws BuildException {
for (Enumeration e = fileprops.keys(); e.hasMoreElements();) {
String name = (String) e.nextElement();
String value = fileprops.getProperty(name);
boolean resolved = false;
while (!resolved) {
Vector fragments = new Vector();
Vector propertyRefs = new Vector();
/// this is the Ant 1.5 way of doing it. The Ant 1.6
/// PropertyHelper
/// should be used -- eventually.
ProjectHelper.parsePropertyString(value, fragments, propertyRefs);
resolved = true;
if (propertyRefs.size() != 0) {
StringBuffer sb = new StringBuffer();
Enumeration i = fragments.elements();
Enumeration j = propertyRefs.elements();
while (i.hasMoreElements()) {
String fragment = (String) i.nextElement();
if (fragment == null) {
String propertyName = (String) j.nextElement();
if (propertyName.equals(name)) {
throw new BuildException("Property " + name + " was circularly " + "defined.");
}
fragment = getProject().getProperty(propertyName);
if (fragment == null) {
if (fileprops.containsKey(propertyName)) {
fragment = fileprops.getProperty(propertyName);
resolved = false;
} else {
fragment = "${" + propertyName + "}";
}
}
}
sb.append(fragment);
}
value = sb.toString();
fileprops.put(name, value);
}
}
}
}