本文整理汇总了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;
}
示例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 );
}
}
示例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);
}
}
示例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;
}