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

Java Resources类代码示例

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

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



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

示例1: collectClassesJarsAndResources

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
/** Also modifies resourceReferences collection */
@SuppressWarnings("unchecked")
private List<String> collectClassesJarsAndResources() {
	Resources filesToProcess = new Resources();
	List<String> result = new ArrayList<String> (filesToProcess.size());
	filesToProcess.setProject(getProject());
	if (filesets == null)
		throw new BuildException("Specify files to process using nested <fileset> element");

	for (FileSet fileset : filesets) {
		filesToProcess.add(fileset);
	}

	Iterator<org.apache.tools.ant.types.Resource> iter = (Iterator<org.apache.tools.ant.types.Resource>) filesToProcess.iterator();
	while (iter.hasNext()) {
		appendClassOrJarOrResource(result, (FileResource) iter.next());
	}
	return result;
}
 
开发者ID:fujaba,项目名称:NetworkParser,代码行数:20,代码来源:IkvmcTask.java


示例2: add

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
/**
 * Add a ResourceCollection.
 * @param c the <code>ResourceCollection</code> to add.
 * @since Ant 1.7
 */
public synchronized void add(ResourceCollection c) {
    if (c == null) {
        return;
    }
    resources = (resources == null) ? new Resources() : resources;
    resources.add(c);
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:Length.java


示例3: addConfiguredStyle

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
/**
 * Add a nested &lt;style&gt; element.
 * @param rc the configured Resources object represented as &lt;style&gt;.
 * @since Ant 1.7
 */
public void addConfiguredStyle(final Resources rc) {
    if (rc.size() != 1) {
        handleError(
            "The style element must be specified with exactly one nested resource.");
    } else {
        setXslResource(rc.iterator().next());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:XSLTProcess.java


示例4: selectSources

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
/**
 * Tells which sources should be reprocessed because the given
 * selector selects at least one target.
 *
 * @param logTo where to send (more or less) interesting output.
 * @param source ResourceCollection.
 * @param mapper filename mapper indicating how to find the target Resources.
 * @param targets object able to map a relative path as a Resource.
 * @param selector returns a selector that is applied to target
 * files.  If it selects at least one target the source will be
 * added to the returned collection.
 * @return ResourceCollection.
 * @since Ant 1.8.0
 */
public static ResourceCollection selectSources(final ProjectComponent logTo,
                                               ResourceCollection source,
                                               final FileNameMapper mapper,
                                               final ResourceFactory targets,
                                               final ResourceSelectorProvider selector) {
    if (source.isEmpty()) {
        logTo.log("No sources found.", Project.MSG_VERBOSE);
        return Resources.NONE;
    }
    source = Union.getInstance(source);

    final Union result = new Union();
    for (final Resource sr : source) {
        String srName = sr.getName();
        srName = srName == null
            ? srName : srName.replace('/', File.separatorChar);

        String[] targetnames = null;
        try {
            targetnames = mapper.mapFileName(srName);
        } catch (final Exception e) {
            logTo.log("Caught " + e + " mapping resource " + sr,
                Project.MSG_VERBOSE);
        }
        if (targetnames == null || targetnames.length == 0) {
            logTo.log(sr + " skipped - don\'t know how to handle it",
                  Project.MSG_VERBOSE);
            continue;
        }
        for (int i = 0; i < targetnames.length; i++) {
            if (targetnames[i] == null) {
                targetnames[i] = "(no name)";
            }
        }
        final Union targetColl = new Union();
        for (int i = 0; i < targetnames.length; i++) {
            targetColl.add(targets.getResource(
                targetnames[i].replace(File.separatorChar, '/')));
        }
        //find the out-of-date targets:
        final Restrict r = new Restrict();
        r.add(selector.getTargetSelectorForSource(sr));
        r.add(targetColl);
        if (r.size() > 0) {
            result.add(sr);
            final Resource t = r.iterator().next();
            logTo.log(sr.getName() + " added as " + t.getName()
                + (t.isExists() ? " is outdated." : " doesn\'t exist."),
                Project.MSG_VERBOSE);
            continue;
        }
        //log uptodateness of all targets:
        logTo.log(sr.getName()
              + " omitted as " + targetColl.toString()
              + (targetColl.size() == 1 ? " is" : " are ")
              + " up to date.", Project.MSG_VERBOSE);
    }
    return result;
}
 
开发者ID:apache,项目名称:ant,代码行数:74,代码来源:ResourceUtils.java


示例5: add

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
public synchronized void add(ResourceCollection c) {
	if (c == null) {
		return;
	}
	resources = (resources == null) ? new Resources() : resources;
	resources.add(c);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:CompileTask.java


示例6: execute

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
/**
 * Do the execution.
 * @throws BuildException if something is invalid.
 */
@Override
public void execute() throws BuildException {
    Resources savedPath = path;
    String savedPathSep = pathSep; // may be altered in validateSetup
    String savedDirSep = dirSep; // may be altered in validateSetup

    try {
        // If we are a reference, create a Path from the reference
        if (isReference()) {
            Object o = refid.getReferencedObject(getProject());
            if (!(o instanceof ResourceCollection)) {
                throw new BuildException(
                    "refid '%s' does not refer to a resource collection.",
                    refid.getRefId());
            }
            getPath().add((ResourceCollection) o);
        }
        validateSetup(); // validate our setup

        // Currently, we deal with only two path formats: Unix and Windows
        // And Unix is everything that is not Windows
        // (with the exception for NetWare and OS/2 below)

        // for NetWare and OS/2, piggy-back on Windows, since here and
        // in the apply code, the same assumptions can be made as with
        // windows - that \\ is an OK separator, and do comparisons
        // case-insensitive.
        String fromDirSep = onWindows ? "\\" : "/";

        StringBuilder rslt = new StringBuilder();

        ResourceCollection resources = isPreserveDuplicates() ? (ResourceCollection) path : new Union(path);
        List<String> ret = new ArrayList<>();
        FileNameMapper mapperImpl = mapper == null ? new IdentityMapper() : mapper.getImplementation();
        for (Resource r : resources) {
            String[] mapped = mapperImpl.mapFileName(String.valueOf(r));
            for (int m = 0; mapped != null && m < mapped.length; ++m) {
                ret.add(mapped[m]);
            }
        }
        boolean first = true;
        for (String string : ret) {
            String elem = mapElement(string); // Apply the path prefix map

            // Now convert the path and file separator characters from the
            // current os to the target os.

            if (!first) {
                rslt.append(pathSep);
            }
            first = false;

            StringTokenizer stDirectory = new StringTokenizer(elem, fromDirSep, true);

            while (stDirectory.hasMoreTokens()) {
                String token = stDirectory.nextToken();
                rslt.append(fromDirSep.equals(token) ? dirSep : token);
            }
        }
        // Place the result into the specified property,
        // unless setonempty == false
        if (setonempty || rslt.length() > 0) {
            String value = rslt.toString();
            if (property == null) {
                log(value);
            } else {
                log("Set property " + property + " = " + value, Project.MSG_VERBOSE);
                getProject().setNewProperty(property, value);
            }
        }
    } finally {
        path = savedPath;
        dirSep = savedDirSep;
        pathSep = savedPathSep;
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:81,代码来源:PathConvert.java


示例7: iterator

import org.apache.tools.ant.types.resources.Resources; //导入依赖的package包/类
@Override
public Iterator<Resource> iterator() {
    return basedirExists() ? fs.iterator() : Resources.EMPTY_ITERATOR;
}
 
开发者ID:apache,项目名称:ant,代码行数:5,代码来源:DependSet.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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