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


Java FullyQualifiedName类代码示例

本文整理汇总了Java中org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName的典型用法代码示例。如果您正苦于以下问题:Java FullyQualifiedName类的具体用法?Java FullyQualifiedName怎么用?Java FullyQualifiedName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getRuntimeRegistratorCode

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getRuntimeRegistratorCode(Optional<FullyQualifiedName> maybeRegistratorType) {
    if (maybeRegistratorType.isPresent()) {
        String registratorType = maybeRegistratorType.get().toString();

        return "\n"+
            format("private %s rootRuntimeBeanRegistratorWrapper;\n", registratorType)+
            "\n"+
            format("public %s getRootRuntimeBeanRegistratorWrapper(){\n", registratorType)+
                "return rootRuntimeBeanRegistratorWrapper;\n"+
            "}\n"+
            "\n"+
            "@Override\n"+
            format("public void setRuntimeBeanRegistrator(%s rootRuntimeRegistrator){\n", RootRuntimeBeanRegistrator.class.getCanonicalName())+
                format("this.rootRuntimeBeanRegistratorWrapper = new %s(rootRuntimeRegistrator);\n", registratorType)+
            "}\n";
    } else {
        return "";
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:AbsModuleGeneratedObjectFactory.java

示例2: toGeneratedObject

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
public GeneratedObject toGeneratedObject(ModuleMXBeanEntry mbe, Optional<String> copyright) {
    FullyQualifiedName absFactoryFQN = new FullyQualifiedName(mbe.getPackageName(), mbe.getAbstractFactoryName());
    FullyQualifiedName moduleFQN = new FullyQualifiedName(mbe.getPackageName(), mbe.getStubModuleName());
    Optional<String> classJavaDoc = Optional.fromNullable(mbe.getNullableDescription());

    AbstractFactoryTemplate abstractFactoryTemplate = TemplateFactory.abstractFactoryTemplateFromMbe(mbe);
    Optional<String> header = abstractFactoryTemplate.getHeaderString();

    List<FullyQualifiedName> providedServices = new ArrayList<>();
    for(String providedService: mbe.getProvidedServices().keySet()) {
        providedServices.add(FullyQualifiedName.fromString(providedService));
    }

    return toGeneratedObject(absFactoryFQN, copyright,
            header, classJavaDoc, mbe.getYangModuleQName(),
            mbe.getGloballyUniqueName(),
            providedServices,
            moduleFQN,
            abstractFactoryTemplate.getFields());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:AbsFactoryGeneratedObjectFactory.java

示例3: toGeneratedObject

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
GeneratedObject toGeneratedObject(FullyQualifiedName concreteFQN,
                                         FullyQualifiedName abstractFQN,
                                         Optional<String> copyright,
                                         Optional<String> header,
                                         Optional<String> classJavaDoc) {
    // there are two constructors and two methods
    JavaFileInputBuilder builder = new JavaFileInputBuilder();
    builder.setTypeName(TypeName.classType);
    builder.setFqn(concreteFQN);
    builder.addExtendsFQN(abstractFQN);

    builder.setCopyright(copyright);
    builder.setHeader(header);
    builder.setClassJavaDoc(classJavaDoc);

    builder.addToBody(getNewCtor(concreteFQN));
    builder.addToBody(getCopyCtor(concreteFQN));
    builder.addToBody(getCustomValidationStub());
    builder.addToBody(getCreateInstanceStub());

    return new GeneratedObjectBuilder(builder.build()).toGeneratedObject();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:ConcreteModuleGeneratedObjectFactory.java

示例4: persistGeneratedObjects

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static List<File> persistGeneratedObjects(final File targetBaseDir, final File mainBaseDir,
        final Map<GeneratedObject, Boolean> gos) throws IOException {
    List<File> generatedFiles = new ArrayList<>();
    for (Entry<GeneratedObject, Boolean> entry : gos.entrySet()) {
        boolean overwrite = entry.getValue();
        File dst;
        if (overwrite) {
            dst = targetBaseDir;
        } else {
            dst = mainBaseDir;
        }
        Optional<Entry<FullyQualifiedName, File>> maybePersistEntry = entry.getKey().persist(dst, overwrite);

        if (maybePersistEntry.isPresent()) {
            generatedFiles.add(maybePersistEntry.get().getValue());
        }
    }
    return generatedFiles;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:CodeWriter.java

示例5: test

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
@Test
public void test() throws Exception {
    FullyQualifiedName fqn = new FullyQualifiedName("foo.bar", "Baz");
    FullyQualifiedName abstractFQN = new FullyQualifiedName("foo.bar", "AbstractBaz");
    String nullableDescription = null;

    ModuleMXBeanEntry moduleMXBeanEntry = mockModuleMXBeanEntry(fqn, abstractFQN, nullableDescription);
    Optional<String> copyright = Optional.absent();
    Optional<String> header = Optional.absent();
    GeneratedObject go = new ConcreteModuleGeneratedObjectFactory().toGeneratedObject(moduleMXBeanEntry, copyright, header);
    Entry<FullyQualifiedName, File> entry = go.persist(generatorOutputPath).get();

    File dstFile = entry.getValue();
    Node c = parse(dstFile);
    assertEquals(fqn.getPackageName(), ((ASTCompilationUnit) c).getPackageDeclaration().getPackageNameImage());
    assertEquals(fqn.getTypeName(), c.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class).getImage());
    assertHasMethodNamed(c, "customValidation");
    assertHasMethodNamed(c, "createInstance");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ConcreteModuleGeneratedObjectFactoryTest.java

示例6: toGeneratedObject

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
public GeneratedObject toGeneratedObject(ModuleMXBeanEntry mbe, Optional<String> copyright) {
    FullyQualifiedName abstractFQN = new FullyQualifiedName(mbe.getPackageName(), mbe.getAbstractModuleName());
    Optional<String> classJavaDoc = Optional.fromNullable(mbe.getNullableDescription());
    AbstractModuleTemplate abstractModuleTemplate = TemplateFactory.abstractModuleTemplateFromMbe(mbe);
    Optional<String> header = abstractModuleTemplate.getHeaderString();

    List<FullyQualifiedName> implementedInterfaces =
            Lists.transform(abstractModuleTemplate.getTypeDeclaration().getImplemented(),
                    FullyQualifiedName::fromString);

    Optional<FullyQualifiedName> extended =
            Optional.fromNullable(
                    Iterables.getFirst(
                            Collections2.transform(abstractModuleTemplate.getTypeDeclaration().getExtended(),
                                    FullyQualifiedName::fromString), null));

    Optional<FullyQualifiedName> maybeRegistratorType;
    if (abstractModuleTemplate.isRuntime()) {
        maybeRegistratorType = Optional.of(FullyQualifiedName.fromString(abstractModuleTemplate.getRegistratorType()));
    } else {
        maybeRegistratorType = Optional.absent();
    }

    return toGeneratedObject(abstractFQN, copyright, header, classJavaDoc, extended, implementedInterfaces,
            abstractModuleTemplate.getModuleFields(), maybeRegistratorType, abstractModuleTemplate.getMethods(),
            mbe.getYangModuleQName());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:28,代码来源:AbsModuleGeneratedObjectFactory.java

示例7: getEqualsAndHashCode

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getEqualsAndHashCode(FullyQualifiedName abstractFQN) {
    return "\n"+
        "@Override\n"+
        "public boolean equals(Object o) {\n"+
            "if (this == o) { return true; }\n"+
            "if (o == null || getClass() != o.getClass()) { return false; }\n"+
            format("%s that = (%1$s) o;\n", abstractFQN.getTypeName())+
            "return identifier.equals(that.identifier);\n"+
        "}\n"+
        "\n"+
        "@Override\n"+
        "public int hashCode() {\n"+
            "return identifier.hashCode();\n"+
        "}\n";
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:AbsModuleGeneratedObjectFactory.java

示例8: getConstructorStart

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getConstructorStart(FullyQualifiedName fqn,
                                          LinkedHashMap<String, String> parameters, String after) {
    String paramString = Joiner.on(",").withKeyValueSeparator(" ").join(parameters);
    return format("public %s(", fqn.getTypeName()) +
            paramString +
            ") {\n" +
            after +
            "}\n";
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbsModuleGeneratedObjectFactory.java

示例9: getNewConstructor

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getNewConstructor(FullyQualifiedName abstractFQN) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");
    String init = "super(identifier, dependencyResolver);\n";
    return getConstructorStart(abstractFQN, parameters, init);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:AbsModuleGeneratedObjectFactory.java

示例10: getCopyFromOldConstructor

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getCopyFromOldConstructor(FullyQualifiedName abstractFQN) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");
    parameters.put(abstractFQN.getTypeName(), "oldModule");
    parameters.put(AutoCloseable.class.getCanonicalName(), "oldInstance");
    String init = "super(identifier, dependencyResolver, oldModule, oldInstance);\n";
    return getConstructorStart(abstractFQN, parameters, init);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbsModuleGeneratedObjectFactory.java

示例11: getCreateModule

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getCreateModule(FullyQualifiedName moduleFQN, List<Field> moduleFields) {
    StringBuilder result = new StringBuilder("\n" +
            "@Override\n");
    result.append(
            format("public %s createModule(String instanceName, %s dependencyResolver, %s old, %s bundleContext) "
                            + "throws Exception {\n",
                    Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(),
                    DynamicMBeanWithInstance.class.getCanonicalName(), BUNDLE_CONTEXT))
            .append(format("%s oldModule;\n", moduleFQN))
            .append("try {\n")
            .append(format("oldModule = (%s) old.getModule();\n", moduleFQN))
            .append("} catch(Exception e) {\n"
                    + "return handleChangedClass(dependencyResolver, old, bundleContext);\n"
                    + "}\n")
            .append(format("%s module = instantiateModule(instanceName, dependencyResolver, oldModule, old"
                            + ".getInstance(), bundleContext);\n",
                    moduleFQN));

    for (Field field : moduleFields) {
        result.append(format("module.set%s(oldModule.get%1$s());\n", field.getName()));
    }

    result.append("\n"
            + "return module;\n"
            + "}\n");
    return result.toString();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:28,代码来源:AbsFactoryGeneratedObjectFactory.java

示例12: getServiceIfcsInitialization

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getServiceIfcsInitialization(List<FullyQualifiedName> providedServices) {
    String generic = format("Class<? extends %s>", AbstractServiceInterface.class.getCanonicalName());

    StringBuilder result = new StringBuilder("static {\n");
    if (!providedServices.isEmpty()) {
        result.append(format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<>();\n", generic));

        for (FullyQualifiedName fqn : providedServices) {
            result.append(format("serviceIfcs2.add(%s.class);\n", fqn));
        }

        result.append("serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);\n");
    } else {
        result.append("serviceIfcs = java.util.Collections.emptySet();\n");
    }
    result.append("}\n");

    // add isModuleImplementingServiceInterface and getImplementedServiceIntefaces methods

    result.append(format("\n"
            + "@Override\n"
            + "public final boolean isModuleImplementingServiceInterface(Class<? extends %1$s> serviceInterface) "
            + "{\n"
            + "for (Class<?> ifc: serviceIfcs) {\n"
            + "if (serviceInterface.isAssignableFrom(ifc)){\n"
            + "return true;\n"
            + "}\n"
            + "}\n"
            + "return false;\n"
            + "}\n"
            + "\n"
            + "@Override\n"
            + "public java.util.Set<Class<? extends %1$s>> getImplementedServiceIntefaces() {\n"
            + "return serviceIfcs;\n"
            + "}\n", AbstractServiceInterface.class.getCanonicalName()));

    return result.toString();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:39,代码来源:AbsFactoryGeneratedObjectFactory.java

示例13: getNewCtor

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getNewCtor(FullyQualifiedName fqn) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");

    StringBuilder stringBuilder = getCtor(fqn, parameters);
    return stringBuilder.toString();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:ConcreteModuleGeneratedObjectFactory.java

示例14: getCtor

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static StringBuilder getCtor(FullyQualifiedName fqn , LinkedHashMap<String, String> parameters) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("public ").append(fqn.getTypeName()).append("(");
    // parameters
    stringBuilder.append(Joiner.on(", ").withKeyValueSeparator(" ").join(parameters));
    stringBuilder.append(") {\n");
    if (!parameters.isEmpty()) {
        stringBuilder.append("super(");
        stringBuilder.append(Joiner.on(", ").join(parameters.values()));
        stringBuilder.append(");\n");
    }
    stringBuilder.append("}");
    return stringBuilder;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:ConcreteModuleGeneratedObjectFactory.java

示例15: getCopyCtor

import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName; //导入依赖的package包/类
private static String getCopyCtor(final FullyQualifiedName fqn) {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<>();
    parameters.put(ModuleIdentifier.class.getCanonicalName(), "identifier");
    parameters.put(DependencyResolver.class.getCanonicalName(), "dependencyResolver");
    parameters.put(fqn.toString(), "oldModule");
    parameters.put(AutoCloseable.class.getCanonicalName(), "oldInstance");
    StringBuilder stringBuilder = getCtor(fqn, parameters);
    return stringBuilder.toString();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:ConcreteModuleGeneratedObjectFactory.java


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