當前位置: 首頁>>代碼示例>>Java>>正文


Java SourceProcessor類代碼示例

本文整理匯總了Java中com.sun.cldc.jna.SourceProcessor的典型用法代碼示例。如果您正苦於以下問題:Java SourceProcessor類的具體用法?Java SourceProcessor怎麽用?Java SourceProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SourceProcessor類屬於com.sun.cldc.jna包,在下文中一共展示了SourceProcessor類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processImports

import com.sun.cldc.jna.SourceProcessor; //導入依賴的package包/類
/**
 * Preprocess a given set of Java import file source files.
 *
 * @param   dstDir     the directory containing the generated Java src files (typically "native")
 * @param   srcDirs    the set of directories that are searched recursively for the source files to be imported
 * @param   j2me       specifies if the classes being compiled are to be deployed on a J2ME platform
 * @return the preprocessor output directory
 */
public File processImports(
        File dstDir,
        File[] srcDirs,
        boolean j2me) {
    // Get the preprocessor output directory
    SourceProcessor sp = new SourceProcessor();


    for (int i = 0; i != srcDirs.length; ++i) {

        File sourceDir = srcDirs[i];

        // A selector that matches a source file whose preprocessed copy does not exist,
        // is younger than the source file or has a last modification date
        // earlier than the last modification date of the properties
        FileSet.Selector outOfDate = new FileSet.DependSelector(new FileSet.SourceDestDirMapper(sourceDir, dstDir)) {

            public boolean isSelected(
                    File file) {
                if (super.isSelected(file)) {
                    return true;
                }
                File preprocessedFile = getMapper().map(file);
                long fileLastModified = preprocessedFile.lastModified();
                return (fileLastModified < env.propertiesLastModified);
            }
        };

        FileSet.Selector selector = new FileSet.AndSelector(JAVA_SOURCE_SELECTOR, outOfDate);
        FileSet fs = new FileSet(sourceDir, selector);
        sp.execute(fs, dstDir);
    }
    return dstDir;
}
 
開發者ID:tomatsu,項目名稱:squawk,代碼行數:43,代碼來源:Build.java


注:本文中的com.sun.cldc.jna.SourceProcessor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。