当前位置: 首页>>代码示例>>Java>>正文


Java ProjectHelper.parsePropertyString方法代码示例

本文整理汇总了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 );
         }
      }
   }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:52,代码来源:Variable.java

示例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 );
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:55,代码来源:PostTask.java

示例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);
			}
		}
	}
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:50,代码来源:Variable.java

示例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);
			}
		}
	}
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:54,代码来源:PostTask.java


注:本文中的org.apache.tools.ant.ProjectHelper.parsePropertyString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。