• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Property类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Property类属于org.apache.tools.ant.taskdefs包,在下文中一共展示了Property类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: execute

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/** Execute this task. */
public void execute () throws BuildException {        
    if ( values.isEmpty() ) {
        throw new BuildException("You must set at least one value!", getLocation());
    }

    if ( target == null ) {
        throw new BuildException("Target must be set!", getLocation());
    }

    for (String val : values) {
        log ("Process '" + val + "' location with '" + target + "' target ...", Project.MSG_VERBOSE);
        
        CallTarget antCall = (CallTarget) getProject().createTask("antcall");
        antCall.init();
        antCall.setLocation(getLocation());
        
        // ant.setDir (dir);
        antCall.setTarget (target);
        Property prop = antCall.createParam();
        prop.setName(name);
        prop.setValue(val);
        
        antCall.execute();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Repeat.java


示例3: doScanSuite

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
private static void doScanSuite(Map<String,Entry> entries, File suite, Map<String,Object> properties, Project project) throws IOException {
    Project fakeproj = new Project();
    fakeproj.setBaseDir(suite); // in case ${basedir} is used somewhere
    Property faketask = new Property();
    faketask.setProject(fakeproj);
    faketask.setFile(new File(suite, "nbproject/private/private.properties".replace('/', File.separatorChar)));
    faketask.execute();
    faketask.setFile(new File(suite, "nbproject/project.properties".replace('/', File.separatorChar)));
    faketask.execute();
    String modulesS = fakeproj.getProperty("modules");
    if (modulesS == null) {
        throw new IOException("No definition of modules in " + suite);
    }
    String[] modules = Path.translatePath(fakeproj, modulesS);
    for (int i = 0; i < modules.length; i++) {
        File module = new File(modules[i]);
        if (!module.isDirectory()) {
            throw new IOException("No such module " + module + " referred to from " + suite);
        }
        if (!scanPossibleProject(module, entries, properties, null, ModuleType.SUITE, project, null)) {
            throw new IOException("No valid module found in " + module + " referred to from " + suite);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ModuleListParser.java


示例4: updateProject

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Updates the Ant Project used in this container with variables set in Ivy.
 *
 * All variables defined in Ivy will be set in the Ant project under two names:
 * <ul>
 * <li>the name of the variable</li>
 * <li>the name of the variable suffixed with a dot + the given id, if the given id is not null
 * </li>
 * </ul>
 *
 * @param id
 *            The identifier of the settings in which the variables have been set, which should
 *            be used as property names suffix
 */
public void updateProject(String id) {
    Map<String, String> r = new HashMap<>(super.getVariables());
    r.putAll(overwrittenProperties);
    for (Map.Entry<String, String> entry : r.entrySet()) {
        setPropertyIfNotSet(entry.getKey(), entry.getValue());
        if (id != null) {
            setPropertyIfNotSet(entry.getKey() + "." + id, entry.getValue());
        }
    }

    if (getEnvironmentPrefix() != null) {
        Property propTask = new Property();
        propTask.setProject(project);
        propTask.setEnvironment(getEnvironmentPrefix());
        propTask.init();
        propTask.execute();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:33,代码来源:IvyAntVariableContainer.java


示例5: handlePropertyParameter

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
private void handlePropertyParameter() {
    if (isRequired() && getProject().getProperty(property) == null) {
        throw new BuildException("expected property '" + property + "': " + description);
    }
    if (!possibleValues.isEmpty()) {
        String currentValue = getProject().getProperty(property);
        if (!possibleValues.contains(currentValue)) {
            throw new BuildException("current value of property '" + property
                    + "' doesn't match with possible values : " + possibleValues.toString());
        }
    }
    if (defaultValue != null && getProject().getProperty(property) == null) {
        Property propTask = new Property();
        propTask.setProject(getProject());
        propTask.setTaskName(getTaskName());
        propTask.setName(property);
        propTask.setValue(defaultValue);
        propTask.execute();
    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:21,代码来源:ParameterTask.java


示例6: buildProject

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
private Project buildProject() {
    Project project = new Project();
    project.setNewProperty(EasyAntMagicNames.AUDIT_MODE, "true");
    project.setNewProperty(EasyAntMagicNames.SKIP_CORE_REVISION_CHECKER, "true");
    project.addReference(EasyAntMagicNames.EASYANT_IVY_INSTANCE, easyantIvySettings);

    TaskCollectorFromImplicitTargetListener listener = new TaskCollectorFromImplicitTargetListener();
    listener.addClassToCollect(ParameterTask.class);
    listener.addClassToCollect(Property.class);
    listener.addClassToCollect(Import.class);
    listener.addClassToCollect(ImportDeferred.class);
    listener.addClassToCollect(Path.class);
    listener.addClassToCollect(PathTask.class);
    listener.addClassToCollect(FileSet.class);
    project.addBuildListener(listener);

    // add a property helper to ignore basedir property on reports
    PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(project);
    propertyHelper.add(new BypassDefaultPropertyExpander());

    project.init();
    ProjectUtils.configureProjectHelper(project);
    return project;
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:25,代码来源:DefaultPluginService.java


示例7: 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


示例8: overrideProperties

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Override the properties in the new project with the one explicitly defined
 * as nested elements here.
 *
 * @exception BuildException  Description of the Exception
 */
private void overrideProperties() throws BuildException {
   Enumeration e = properties.elements();
   while ( e.hasMoreElements() ) {
      Property p = (Property)e.nextElement();
      p.setProject( newProject );
      p.execute();
   }
   getProject().copyInheritedProperties( newProject );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:AntFetch.java


示例9: createProperty

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Property to pass to the new project. The property is passed as a 'user
 * property'
 *
 * @return   Description of the Return Value
 */
public Property createProperty() {
   if ( newProject == null ) {
      reinit();
   }
   /*
    *  Property p = new Property( true, getProject() );
    */
   Property p = new Property();
   p.setProject( newProject );
   p.setTaskName( "property" );
   properties.addElement( p );
   return p;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:AntFetch.java


示例10: setIfNotSetAlready

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Set a System.property with this value if it is not already set.
 * 
 * @return
 */
public static boolean setIfNotSetAlready(Property property)
{
    if (System.getProperty(property.getName()) == null)
    {
        System.setProperty(property.getName(), (property.getValue() == null ? "" : property
                .getValue()));
        TaskLog.log("Setting property '" + property.getName() + "' to value '"
                + property.getValue() + "'");
        return true;
    }

    return false;
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:19,代码来源:SystemProperties.java


示例11: setSystemProperties

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Sets the system properties.
 */
private void setSystemProperties()
{
    if (systemProperties != null)
    {
        Iterator propertiesIterator = systemProperties.getSystemProperties().iterator();
        while (propertiesIterator.hasNext())
        {
            Property property = ((Property) propertiesIterator.next());
            SystemProperties.setIfNotSetAlready(property);
        }
    }
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:16,代码来源:JettyRunTask.java


示例12: setPropertyValue

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
protected final void setPropertyValue(String value) {
	if (value != null) {
		if (override) {
			if (getProject().getUserProperty(property) == null)
				getProject().setProperty(property, value);
			else
				getProject().setUserProperty(property, value);
		} else {
			Property p = (Property) project.createTask("property");
			p.setName(property);
			p.setValue(value);
			p.execute();
		}
	}
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:16,代码来源:AbstractPropertySetterTask.java


示例13: 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


示例14: overrideProperties

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Override the properties in the new project with the one explicitly
 * defined as nested elements here.
 *
 * @exception BuildException
 *                Description of the Exception
 */
private void overrideProperties() throws BuildException {
	Enumeration e = properties.elements();
	while (e.hasMoreElements()) {
		Property p = (Property) e.nextElement();
		p.setProject(newProject);
		p.execute();
	}
	getProject().copyInheritedProperties(newProject);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:17,代码来源:AntCallBack.java


示例15: createProperty

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
/**
 * Property to pass to the new project. The property is passed as a 'user
 * property'
 *
 * @return Description of the Return Value
 */
public Property createProperty() {
	if (newProject == null) {
		reinit();
	}
	/*
	 * Property p = new Property( true, getProject() );
	 */
	Property p = new Property();
	p.setProject(newProject);
	p.setTaskName("property");
	properties.addElement(p);
	return p;
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:20,代码来源:AntCallBack.java


示例16: setResultPropertyValue

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
protected final void setResultPropertyValue(Project project, String value) {
	if (value != null) {
		if (override) {
			if (project.getUserProperty(resultproperty) == null)
				project.setProperty(resultproperty, value);
			else
				project.setUserProperty(resultproperty, value);
		} else {
			Property p = (Property) project.createTask("property");
			p.setName(resultproperty);
			p.setValue(value);
			p.execute();
		}
	}
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:16,代码来源:IniFileTask.java


示例17: execute

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
public boolean execute(Project project, long contentLength, InputStream content) throws Throwable {
	Ant ant = (Ant) project.createTask("ant");
	File baseDir = project.getBaseDir();
	if (dir != null)
		baseDir = new File(dir);
	ant.setDir(baseDir);
	ant.setInheritAll(inheritall);
	ant.setInheritRefs(interitrefs);

	if (target != null)
		ant.setTarget(target);

	if (antFile != null)
		ant.setAntfile(antFile);

	Enumeration e = properties.elements();
	PropertyContainer pc = null;
	Property p = null;
	while (e.hasMoreElements()) {
		pc = (PropertyContainer) e.nextElement();
		p = ant.createProperty();
		p.setName(pc.getName());
		p.setValue(pc.getValue());
	}

	e = references.elements();
	ReferenceContainer rc = null;
	Ant.Reference ref = null;
	while (e.hasMoreElements()) {
		rc = (ReferenceContainer) e.nextElement();
		ref = new Ant.Reference();
		ref.setRefId(rc.getRefId());
		ref.setToRefid(rc.getToRefId());
		ant.addReference(ref);
	}

	ant.execute();

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


示例18: execute

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
public boolean execute(Project project, long contentLength, InputStream content) throws Throwable {
	CallTarget callTarget = (CallTarget) project.createTask("antcall");
	callTarget.setInheritAll(inheritall);
	callTarget.setInheritRefs(interitrefs);

	String toExecute = target;
	if (toExecute == null)
		toExecute = project.getDefaultTarget();
	callTarget.setTarget(toExecute);

	Enumeration e = properties.elements();
	PropertyContainer pc = null;
	Property p = null;
	while (e.hasMoreElements()) {
		pc = (PropertyContainer) e.nextElement();
		p = callTarget.createParam();
		p.setName(pc.getName());
		p.setValue(pc.getValue());
	}

	e = references.elements();
	ReferenceContainer rc = null;
	Ant.Reference ref = null;
	while (e.hasMoreElements()) {
		rc = (ReferenceContainer) e.nextElement();
		ref = new Ant.Reference();
		ref.setRefId(rc.getRefId());
		ref.setToRefid(rc.getToRefId());
		callTarget.addReference(ref);
	}

	callTarget.execute();

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


示例19: deliverDependency

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
public void deliverDependency(ModuleRevisionId depMrid, String version, String status,
        String depStatus) {
    if (isNullOrEmpty(deliverTarget)) {
        return;
    }
    // call deliver target if any
    CallTarget ct = (CallTarget) getProject().createTask("antcall");
    ct.setOwningTarget(getOwningTarget());
    ct.init();
    ct.setTarget(deliverTarget);
    ct.setInheritAll(true);
    ct.setInheritRefs(true);
    Property param = ct.createParam();
    param.setName("dependency.name");
    param.setValue(depMrid.getName());
    param = ct.createParam();
    param.setName("dependency.published.status");
    param.setValue(status);
    param = ct.createParam();
    param.setName("dependency.published.version");
    param.setValue(version);
    param = ct.createParam();
    param.setName("dependency.version");
    param.setValue(depMrid.getRevision());
    param = ct.createParam();
    param.setName("dependency.status");
    param.setValue(depStatus == null ? "null" : depStatus);

    ct.perform();

    String deliveredProperty = depMrid.getName() + "." + depMrid.getRevision()
            + ".delivered";
    getProject().setProperty(deliveredProperty, "true");
    appendDeliveryList(deliveredProperty + " = true");

    getProject().setProperty("recursive." + depMrid.getName() + ".delivered", "true");
    appendDeliveryList("recursive." + depMrid.getName() + ".delivered" + " = true");
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:39,代码来源:IvyDeliver.java


示例20: loadDeliveryList

import org.apache.tools.ant.taskdefs.Property; //导入依赖的package包/类
private void loadDeliveryList() {
    Property property = (Property) getProject().createTask("property");
    property.setOwningTarget(getOwningTarget());
    property.init();
    property.setFile(deliveryList);
    property.perform();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:8,代码来源:IvyDeliver.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EntityAIMoveTowardsTarget类代码示例发布时间:2022-05-21
下一篇:
Java SolrResourceLoader类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap