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


Java Mapper类代码示例

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


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

示例1: normalize

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
private static String normalize(String path, List<Mapper> mappers) throws IOException {
    try {
        for (Mapper m : mappers) {
            String[] nue = m.getImplementation().mapFileName(path);
            if (nue != null) {
                for (int i = 0; i < nue.length; i++) {
                    File f = new File(nue[i]);
                    if (f.isFile()) {
                        return new File(f.toURI().normalize()).getAbsolutePath();
                    }
                }
            }
        }
        return path;
    } catch (BuildException e) {
        throw new IOException(e.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CheckLinks.java

示例2: testGlobMapperRelativePath

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testGlobMapperRelativePath() {
    DependSelector s = new DependSelector();
    File subdir = new File("selectortest/tar/bz2");
    s.setTargetdir(subdir);

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");

    String results = selectorRule.selectionString(s);
    assertEquals("FFTFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:DependSelectorTest.java

示例3: testRestrictedGlobMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testRestrictedGlobMapper() {
    DependSelector s = new DependSelector();
    File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
    s.setTargetdir(subdir);

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");
    String results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:DependSelectorTest.java

示例4: testMirroredSelection

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testMirroredSelection() {
    DependSelector s = new DependSelector();
    s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");
    String results = selectorRule.mirrorSelectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
    results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:DependSelectorTest.java

示例5: addConfiguredLicenseMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Adds a license mapper.
 */
public void addConfiguredLicenseMapper(Mapper mapper) {
  if (licenseMapper != null) {
    throw new BuildException("Only one license mapper is allowed.");
  }
  this.licenseMapper = mapper.getImplementation();
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:LicenseCheckTask.java

示例6: addMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Add a mapper to convert the file names.
 *
 * @param mapper
 *            a Mapper value.
 */
public void addMapper(Mapper mapper) {
    if (this.mapper != null) {
        throw new IllegalArgumentException("Cannot define more than one mapper");
    }
    this.mapper = mapper;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:13,代码来源:IvyRetrieve.java

示例7: execute

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Executes the task.
 *
 * @throws BuildException is there is a problem in the task execution.
 */
public void execute() throws BuildException {

    // first off, make sure that we've got a from and to extension
    if (fromExtension == null || toExtension == null || srcDir == null) {
        throw new BuildException("srcDir, fromExtension and toExtension "
            + "attributes must be set!");
    }

    log("DEPRECATED - The renameext task is deprecated.  Use move instead.",
        Project.MSG_WARN);
    log("Replace this with:", Project.MSG_INFO);
    log("<move todir=\"" + srcDir + "\" overwrite=\"" + replace + "\">",
        Project.MSG_INFO);
    log("  <fileset dir=\"" + srcDir + "\" />", Project.MSG_INFO);
    log("  <mapper type=\"glob\"", Project.MSG_INFO);
    log("          from=\"*" + fromExtension + "\"", Project.MSG_INFO);
    log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
    log("</move>", Project.MSG_INFO);
    log("using the same patterns on <fileset> as you\'ve used here",
        Project.MSG_INFO);

    Move move = new Move();
    move.bindToOwner(this);
    move.setOwningTarget(getOwningTarget());
    move.setTaskName(getTaskName());
    move.setLocation(getLocation());
    move.setTodir(srcDir);
    move.setOverwrite(replace);

    fileset.setDir(srcDir);
    move.addFileset(fileset);

    Mapper me = move.createMapper();
    me.setType(globType);
    me.setFrom("*" + fromExtension);
    me.setTo("*" + toExtension);

    move.execute();
}
 
开发者ID:apache,项目名称:ant,代码行数:45,代码来源:RenameExtensions.java

示例8: addMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Add a mapper to convert the file names.
 *
 * @param mapper a <code>Mapper</code> value.
 */
public void addMapper(Mapper mapper) {
    if (this.mapper != null) {
        throw new BuildException(
            "Cannot define more than one mapper");
    }
    this.mapper = mapper;
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:PathConvert.java

示例9: addMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Defines the mapper to map source to destination files.
 * @param mapper the mapper to use
 * @exception BuildException if more than one mapper is defined
 * @since Ant 1.6.2
 */
public void addMapper(final Mapper mapper) {
    if (mapperElement != null) {
        handleError("Cannot define more than one mapper");
    } else {
        mapperElement = mapper;
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:XSLTProcess.java

示例10: testIdentityMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testIdentityMapper() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType identity = new Mapper.MapperType();
    identity.setValue("identity");

    Mapper m = s.createMapper();
    m.setType(identity);

    String results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFFFF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:DependSelectorTest.java

示例11: testMergeMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testMergeMapper() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType merge = new Mapper.MapperType();
    merge.setValue("merge");

    Mapper m = s.createMapper();
    m.setType(merge);
    m.setTo("asf-logo.gif.gz");

    String results = selectorRule.selectionString(s);
    assertEquals("TFFFFTTTFFF", results.substring(0,11));
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:DependSelectorTest.java

示例12: testMergeMapper2

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
@Test
public void testMergeMapper2() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType merge = new Mapper.MapperType();
    merge.setValue("merge");

    Mapper m = s.createMapper();
    m.setType(merge);
    m.setTo("asf-logo.gif.bz2");
    String results = selectorRule.selectionString(s);
    assertEquals("TTFTTTTTTTTT", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:DependSelectorTest.java

示例13: addMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/** Mapper to be applied to each property in the list before its
 * value is taken
 */
public void addMapper(Mapper m) {
    this.mapper = m;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ResolveList.java

示例14: checkHelpSet

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
private void checkHelpSet(File hsfile) throws Exception {
    log("Checking helpset: " + hsfile);
    HelpSet hs = new HelpSet(null, hsfile.toURI().toURL());
    javax.help.Map map = hs.getCombinedMap();
    log("Parsed helpset, checking map IDs in TOC/Index navigators...");
    NavigatorView[] navs = hs.getNavigatorViews();
    for (int i = 0; i < navs.length; i++) {
        String name = navs[i].getName();
        File navfile = new File(hsfile.getParentFile(), (String)navs[i].getParameters().get("data"));
        if (! navfile.exists()) throw new BuildException("Navigator " + name + " not found", new Location(navfile.getAbsolutePath()));
        if (navs[i] instanceof IndexView) {
            log("Checking index navigator " + name, Project.MSG_VERBOSE);
            IndexView.parse(navfile.toURI().toURL(), hs, Locale.getDefault(), new VerifyTIFactory(hs, map, navfile, false));
        } else if (navs[i] instanceof TOCView) {
            log("Checking TOC navigator " + name, Project.MSG_VERBOSE);
            TOCView.parse(navfile.toURI().toURL(), hs, Locale.getDefault(), new VerifyTIFactory(hs, map, navfile, true));
        } else {
            log("Skipping non-TOC/Index view: " + name, Project.MSG_VERBOSE);
        }
    }
    log("Checking for duplicate map IDs...");
    HelpSet.parse(hsfile.toURI().toURL(), null, new VerifyHSFactory());
    log("Checking links from help map and between HTML files...");
    @SuppressWarnings("unchecked")
    Enumeration<javax.help.Map.ID> e = map.getAllIDs();
    Set<URI> okurls = new HashSet<>(1000);
    Set<URI> badurls = new HashSet<>(1000);
    Set<URI> cleanurls = new HashSet<>(1000);
    while (e.hasMoreElements()) {
        javax.help.Map.ID id = e.nextElement();
        URL u = map.getURLFromID(id);
        if (u == null) {
            throw new BuildException("Bogus map ID: " + id.id, new Location(hsfile.getAbsolutePath()));
        }
        log("Checking ID " + id.id, Project.MSG_VERBOSE);
        List<String> errors = new ArrayList<>();
        CheckLinks.scan(this, null, null, id.id, "", 
        u.toURI(), okurls, badurls, cleanurls, false, false, false, 2, 
        Collections.<Mapper>emptyList(), errors);
        for (String error : errors) {
            log(error, Project.MSG_WARN);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:CheckHelpSets.java

示例15: createMapper

import org.apache.tools.ant.types.Mapper; //导入依赖的package包/类
/**
 * Add a mapper to translate file names to the "originals".
 */
public Mapper createMapper() {
    Mapper m = new Mapper(getProject());
    mappers.add(m);
    return m;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CheckLinks.java


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