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


Java ScannerContext.getStore方法代码示例

本文整理汇总了Java中com.buschmais.jqassistant.core.scanner.api.ScannerContext.getStore方法的典型用法代码示例。如果您正苦于以下问题:Java ScannerContext.getStore方法的具体用法?Java ScannerContext.getStore怎么用?Java ScannerContext.getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.buschmais.jqassistant.core.scanner.api.ScannerContext的用法示例。


在下文中一共展示了ScannerContext.getStore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scan

import com.buschmais.jqassistant.core.scanner.api.ScannerContext; //导入方法依赖的package包/类
@Override
public ManifestFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    try (InputStream stream = item.createStream()) {
        Manifest manifest = new Manifest(stream);
        ScannerContext context = scanner.getContext();
        Store store = context.getStore();
        FileDescriptor fileDescriptor = context.getCurrentDescriptor();
        ManifestFileDescriptor manifestFileDescriptor = store.addDescriptorType(fileDescriptor, ManifestFileDescriptor.class);
        ManifestSectionDescriptor mainSectionDescriptor = store.create(ManifestSectionDescriptor.class);
        mainSectionDescriptor.setName(SECTION_MAIN);
        manifestFileDescriptor.setMainSection(mainSectionDescriptor);
        readSection(manifest.getMainAttributes(), mainSectionDescriptor, store);
        for (Map.Entry<String, Attributes> sectionEntry : manifest.getEntries().entrySet()) {
            ManifestSectionDescriptor sectionDescriptor = store.create(ManifestSectionDescriptor.class);
            sectionDescriptor.setName(sectionEntry.getKey());
            readSection(sectionEntry.getValue(), sectionDescriptor, store);
            manifestFileDescriptor.getManifestSections().add(sectionDescriptor);
        }
        return manifestFileDescriptor;
    }
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:22,代码来源:ManifestFileScannerPlugin.java

示例2: scan

import com.buschmais.jqassistant.core.scanner.api.ScannerContext; //导入方法依赖的package包/类
@Override
public PropertyFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    ScannerContext context = scanner.getContext();
    Store store = context.getStore();
    FileDescriptor fileDescriptor = context.getCurrentDescriptor();
    PropertyFileDescriptor propertyFileDescriptor = store.addDescriptorType(fileDescriptor, PropertyFileDescriptor.class);
    Properties properties = new Properties();
    try (InputStream stream = item.createStream()) {
        properties.load(stream);
    } catch (IllegalArgumentException e) {
        LOGGER.warn("Cannot load properties from '" + path + "': " + e.getMessage());
    }
    for (String name : properties.stringPropertyNames()) {
        String value = properties.getProperty(name);
        PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
        propertyDescriptor.setName(name);
        propertyDescriptor.setValue(value);
        propertyFileDescriptor.getProperties().add(propertyDescriptor);
    }
    return propertyFileDescriptor;
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:22,代码来源:PropertyFileScannerPlugin.java

示例3: scan

import com.buschmais.jqassistant.core.scanner.api.ScannerContext; //导入方法依赖的package包/类
@Override
public PropertyFileDescriptor scan(FileResource item, String path, Scope scope, Scanner scanner) throws IOException {
    ScannerContext context = scanner.getContext();
    Store store = context.getStore();
    FileDescriptor fileDescriptor = context.getCurrentDescriptor();
    Class<XmlPropertyFileDescriptor> descriptorType = XmlPropertyFileDescriptor.class;
    PropertyFileDescriptor propertyFileDescriptor = store.addDescriptorType(fileDescriptor, descriptorType);
    Properties properties = new Properties();
    try (InputStream stream = item.createStream()) {
        properties.loadFromXML(stream);
    } catch (IllegalArgumentException e) {
        LOGGER.warn("Cannot load properties from '" + path + "': " + e.getMessage());
    }

    for (String name : properties.stringPropertyNames()) {
        String value = properties.getProperty(name);
        PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
        propertyDescriptor.setName(name);
        propertyDescriptor.setValue(value);
        propertyFileDescriptor.getProperties().add(propertyDescriptor);
    }
    return propertyFileDescriptor;
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:24,代码来源:XmlPropertyFileScannerPlugin.java

示例4: getContainerDescriptor

import com.buschmais.jqassistant.core.scanner.api.ScannerContext; //导入方法依赖的package包/类
@Override
protected JavaClassesDirectoryDescriptor getContainerDescriptor(File classPathDirectory, ScannerContext scannerContext) {
    JavaArtifactFileDescriptor javaArtifactDescriptor = scannerContext.peekOrDefault(JavaArtifactFileDescriptor.class, null);
    Store store = scannerContext.getStore();
    if (javaArtifactDescriptor == null) {
        return store.create(JavaClassesDirectoryDescriptor.class);
    }
    if (JavaClassesDirectoryDescriptor.class.isAssignableFrom(javaArtifactDescriptor.getClass())) {
        return JavaClassesDirectoryDescriptor.class.cast(javaArtifactDescriptor);
    }
    throw new IllegalStateException("Expected an instance of " + JavaClassesDirectoryDescriptor.class.getName() + " but got "
            + Arrays.asList(javaArtifactDescriptor.getClass().getInterfaces()));
}
 
开发者ID:buschmais,项目名称:jqa-java-plugin,代码行数:14,代码来源:JavaClassesDirectoryScannerPlugin.java


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