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


Java Property.getValue方法代码示例

本文整理汇总了Java中org.apache.tools.ant.taskdefs.Property.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getValue方法的具体用法?Java Property.getValue怎么用?Java Property.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.taskdefs.Property的用法示例。


在下文中一共展示了Property.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readProperties

import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private Properties readProperties(Vector <? extends Property> antProperties) throws IOException {
    Properties props = new Properties();
    for(Property prop : antProperties) {
        if(prop.getName()!=null) {
            if(prop.getValue()!=null) {
                props.setProperty(prop.getName(), prop.getValue());
            } else if(prop.getLocation()!=null) {
                props.setProperty(prop.getName(),
                        new File(prop.getLocation().getFileName()).getAbsolutePath());
            }
        } else if(prop.getFile()!=null || prop.getUrl()!=null) {
            InputStream is = null;
            try {
                is = (prop.getFile()!=null) ?
                    new FileInputStream(prop.getFile()) :
                    prop.getUrl().openStream();
                
                Properties loadedProps = new Properties();
                loadedProps.load(is);
                is.close();
                if ( prop.getPrefix() != null ) {
                    for(Object p : loadedProps.keySet()) {
                        props.setProperty(prop.getPrefix() + p,
                                loadedProps.getProperty(p.toString()));
                    }
                } else {
                    props.putAll(loadedProps);
                }
            } finally {
                if (is != null) {
                    is.close();
                }
            }
        }
    }
    
    return props;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:CreateBundle.java

示例2: reinit

import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
 * Called in execute or createProperty if newProject is null. <p>
 *
 * This can happen if the same instance of this task is run twice as
 * newProject is set to null at the end of execute (to save memory and help
 * the GC).</p> <p>
 *
 * Sets all properties that have been defined as nested property elements.
 * </p>
 */
private void reinit() {
   init();
   final int count = properties.size();
   for ( int i = 0; i < count; i++ ) {
      Property p = (Property)properties.elementAt( i );
      Property newP = (Property)newProject.createTask( "property" );
      newP.setName( p.getName() );
      if ( p.getValue() != null ) {
         newP.setValue( p.getValue() );
      }
      if ( p.getFile() != null ) {
         newP.setFile( p.getFile() );
      }
      if ( p.getResource() != null ) {
         newP.setResource( p.getResource() );
      }
      if ( p.getPrefix() != null ) {
         newP.setPrefix( p.getPrefix() );
      }
      if ( p.getRefid() != null ) {
         newP.setRefid( p.getRefid() );
      }
      if ( p.getEnvironment() != null ) {
         newP.setEnvironment( p.getEnvironment() );
      }
      if ( p.getClasspath() != null ) {
         newP.setClasspath( p.getClasspath() );
      }
      properties.setElementAt( newP, i );
   }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:AntFetch.java

示例3: reinit

import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
 * Called in execute or createProperty if newProject is null.
 * <p>
 *
 * This can happen if the same instance of this task is run twice as
 * newProject is set to null at the end of execute (to save memory and help
 * the GC).
 * </p>
 * <p>
 *
 * Sets all properties that have been defined as nested property elements.
 * </p>
 */
private void reinit() {
	init();
	final int count = properties.size();
	for (int i = 0; i < count; i++) {
		Property p = (Property) properties.elementAt(i);
		Property newP = (Property) newProject.createTask("property");
		newP.setName(p.getName());
		if (p.getValue() != null) {
			newP.setValue(p.getValue());
		}
		if (p.getFile() != null) {
			newP.setFile(p.getFile());
		}
		if (p.getResource() != null) {
			newP.setResource(p.getResource());
		}
		if (p.getPrefix() != null) {
			newP.setPrefix(p.getPrefix());
		}
		if (p.getRefid() != null) {
			newP.setRefid(p.getRefid());
		}
		if (p.getEnvironment() != null) {
			newP.setEnvironment(p.getEnvironment());
		}
		if (p.getClasspath() != null) {
			newP.setClasspath(p.getClasspath());
		}
		properties.setElementAt(newP, i);
	}
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:45,代码来源:AntCallBack.java

示例4: createCallTarget

import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private CallTarget createCallTarget() {
	CallTarget ct = (CallTarget) getProject().createTask("antcall");
	ct.setOwningTarget(getOwningTarget());
	ct.init();
	ct.setTarget(target);
	ct.setInheritAll(inheritAll);
	ct.setInheritRefs(inheritRefs);
	Enumeration e = params.elements();
	while (e.hasMoreElements()) {
		Property param = (Property) e.nextElement();
		Property toSet = ct.createParam();
		toSet.setName(param.getName());
		if (param.getValue() != null) {
			toSet.setValue(param.getValue());
		}
		if (param.getFile() != null) {
			toSet.setFile(param.getFile());
		}
		if (param.getResource() != null) {
			toSet.setResource(param.getResource());
		}
		if (param.getPrefix() != null) {
			toSet.setPrefix(param.getPrefix());
		}
		if (param.getRefid() != null) {
			toSet.setRefid(param.getRefid());
		}
		if (param.getEnvironment() != null) {
			toSet.setEnvironment(param.getEnvironment());
		}
		if (param.getClasspath() != null) {
			toSet.setClasspath(param.getClasspath());
		}
	}

	e = references.elements();
	while (e.hasMoreElements()) {
		ct.addReference((Ant.Reference) e.nextElement());
	}

	return ct;
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:43,代码来源:ForEach.java


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