本文整理汇总了Java中org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc类的典型用法代码示例。如果您正苦于以下问题:Java AttributeIfc类的具体用法?Java AttributeIfc怎么用?Java AttributeIfc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeIfc类属于org.opendaylight.controller.config.yangjmxgenerator.attribute包,在下文中一共展示了AttributeIfc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReturnTypeAttribute
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private static AttributeIfc getReturnTypeAttribute(final DataSchemaNode child, final TypeProviderWrapper typeProviderWrapper,
final String packageName) {
if (child instanceof LeafSchemaNode) {
LeafSchemaNode leaf = (LeafSchemaNode) child;
return new JavaAttribute(leaf, typeProviderWrapper);
} else if (child instanceof ContainerSchemaNode) {
ContainerSchemaNode container = (ContainerSchemaNode) child;
TOAttribute toAttribute = TOAttribute.create(container, typeProviderWrapper, packageName);
return toAttribute;
} else if (child instanceof ListSchemaNode) {
return ListAttribute.create((ListSchemaNode) child, typeProviderWrapper, packageName);
} else if (child instanceof LeafListSchemaNode) {
return ListAttribute.create((LeafListSchemaNode) child, typeProviderWrapper);
} else {
throw new IllegalStateException("Unknown output data node " + child + " for rpc");
}
}
示例2: caseTOAttribute
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
@Override
protected AttributeWritingStrategy caseTOAttribute(final CompositeType openType) {
Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
Map<String, AttributeWritingStrategy> innerStrats = Maps.newHashMap();
String currentKey = key;
for (Entry<String, AttributeIfc> innerAttrEntry : ((TOAttribute) getLastAttribute())
.getYangPropertiesToTypesMap().entrySet()) {
AttributeWritingStrategy innerStrategy = prepareWritingStrategy(innerAttrEntry.getKey(),
innerAttrEntry.getValue(), document);
innerStrats.put(innerAttrEntry.getKey(), innerStrategy);
}
return new CompositeAttributeWritingStrategy(document, currentKey, innerStrats);
}
示例3: getEquals
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private MethodDefinition getEquals(final Map<String, AttributeIfc> attrs) {
final StringBuilder equalsBodyBuilder = new StringBuilder(
" if (this == o) { return true; }\n" +
" if (o == null || getClass() != o.getClass()) { return false; }\n");
equalsBodyBuilder.append(String.format(
" final %s that = (%s) o;\n", this.name, this.name));
for (final AttributeIfc s : attrs.values()) {
equalsBodyBuilder.append(String.format(
" if (!java.util.Objects.equals(%1$s, that.%1$s)) {\n" +
" return false;\n" +
" }\n\n", s.getLowerCaseCammelCase()));
}
equalsBodyBuilder.append(
" return true;\n");
return new MethodDefinition("boolean", "equals", Collections.singletonList(new Field("Object", "o")),
Collections.singletonList(new Annotation("Override", Collections.<Parameter>emptyList())), equalsBodyBuilder.toString());
}
示例4: mockMbe
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
public static ModuleMXBeanEntry mockMbe(final String packageName) {
final ModuleMXBeanEntry mbe = mock(ModuleMXBeanEntry.class);
final Map<String, AttributeIfc> a = Maps.newHashMap();
final JavaAttribute attr = mockJavaAttr();
a.put("attr1", attr);
doReturn(a).when(mbe).getAttributes();
doReturn(packageName).when(mbe).getPackageName();
doReturn(Collections.emptyMap()).when(mbe).getProvidedServices();
doReturn("yang-module").when(mbe).getYangModuleName();
doReturn("local").when(mbe).getYangModuleLocalname();
doReturn("AbstractType").when(mbe).getAbstractFactoryName();
doReturn("Module").when(mbe).getStubModuleName();
doReturn("fullA").when(mbe).getFullyQualifiedName(anyString());
doReturn("uniq").when(mbe).getGloballyUniqueName();
return mbe;
}
示例5: cleanUpNulls
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private static void cleanUpNulls(final Map<String, ModuleMXBeanEntry> result) {
for (Map.Entry<String, ModuleMXBeanEntry> entry : result.entrySet()) {
ModuleMXBeanEntry module = entry.getValue();
if (module.getAttributes() == null) {
module.setYangToAttributes(Collections
.<String, AttributeIfc> emptyMap());
} else if (module.getRuntimeBeans() == null) {
module.setRuntimeBeans(Collections
.<RuntimeBeanEntry> emptyList());
}
}
}
示例6: checkUniqueAttributesWithGeneratedClass
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private static void checkUniqueAttributesWithGeneratedClass(final Map<String, QName> uniqueGeneratedClassNames,
final QName parentQName, final Map<String, AttributeIfc> yangToAttributes) {
for (Map.Entry<String, AttributeIfc> attr : yangToAttributes.entrySet()) {
if (attr.getValue() instanceof TOAttribute) {
checkUniqueTOAttr(uniqueGeneratedClassNames, parentQName, (TOAttribute) attr.getValue());
} else if (attr.getValue() instanceof ListAttribute
&& ((ListAttribute) attr.getValue()).getInnerAttribute() instanceof TOAttribute) {
checkUniqueTOAttr(uniqueGeneratedClassNames, parentQName,
(TOAttribute) ((ListAttribute) attr.getValue()).getInnerAttribute());
}
}
}
示例7: fillConfiguration
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private static Map<String, AttributeIfc> fillConfiguration(final DataNodeContainer dataNodeContainer, final Module currentModule,
final TypeProviderWrapper typeProviderWrapper, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
final SchemaContext schemaContext, final String packageName) {
Map<String, AttributeIfc> yangToAttributes = new HashMap<>();
for (DataSchemaNode attrNode : dataNodeContainer.getChildNodes()) {
AttributeIfc attributeValue = getAttributeValue(attrNode, currentModule, qNamesToSIEs, typeProviderWrapper,
schemaContext, packageName);
yangToAttributes.put(attributeValue.getAttributeYangName(), attributeValue);
}
return yangToAttributes;
}
示例8: RuntimeBeanEntry
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
@VisibleForTesting
RuntimeBeanEntry(final String packageName,
final DataNodeContainer nodeForReporting, final String yangName,
final String javaNamePrefix, final boolean isRoot,
final Optional<String> keyYangName, final List<AttributeIfc> attributes,
final List<RuntimeBeanEntry> children, final Set<Rpc> rpcs) {
checkArgument(isRoot == false || keyYangName.isPresent() == false,
"Root RuntimeBeanEntry must not have key set");
this.packageName = packageName;
this.isRoot = isRoot;
this.yangName = yangName;
this.javaNamePrefix = javaNamePrefix;
this.children = Collections.unmodifiableList(children);
this.rpcs = Collections.unmodifiableSet(rpcs);
this.keyYangName = keyYangName;
Map<String, AttributeIfc> map = new HashMap<>();
for (AttributeIfc a : attributes) {
checkState(map.containsKey(a.getAttributeYangName()) == false,
"Attribute already defined: %s in %s", a.getAttributeYangName(), nodeForReporting);
map.put(a.getAttributeYangName(), a);
}
if (keyYangName.isPresent()) {
AttributeIfc keyJavaName = map.get(keyYangName.get());
checkArgument(keyJavaName != null, "Key %s not found in attribute list %s in %s", keyYangName.get(),
attributes, nodeForReporting);
this.keyJavaName = Optional
.of(keyJavaName.getUpperCaseCammelCase());
} else {
keyJavaName = Optional.absent();
}
attributeMap = Collections.unmodifiableMap(map);
}
示例9: extractClassNameToRuntimeBeanMap
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
/**
* @return map containing all class names as key, extracted RuntimeBeans as
* values. If more than zero values is returned, exactly one
* RuntimeBeanEntry will have isRoot set to true, even if yang does
* not contain special configuration for it.
*/
public static Map<String, RuntimeBeanEntry> extractClassNameToRuntimeBeanMap(
final String packageName, final DataNodeContainer container,
final String moduleYangName, final TypeProviderWrapper typeProviderWrapper,
final String javaNamePrefix, final Module currentModule, final SchemaContext schemaContext) {
AttributesRpcsAndRuntimeBeans attributesRpcsAndRuntimeBeans = extractSubtree(
packageName, container, typeProviderWrapper, currentModule,
schemaContext);
Map<String, RuntimeBeanEntry> result = new HashMap<>();
List<AttributeIfc> attributes;
Set<Rpc> rpcs;
if (attributesRpcsAndRuntimeBeans.isEmpty() == false) {
attributes = attributesRpcsAndRuntimeBeans.getAttributes();
rpcs = attributesRpcsAndRuntimeBeans.getRpcs();
} else {
// create artificial root if not defined in yang
attributes = Collections.emptyList();
rpcs = Collections.emptySet();
}
RuntimeBeanEntry rootRuntimeBeanEntry = createRoot(packageName,
container, moduleYangName, attributes, javaNamePrefix,
attributesRpcsAndRuntimeBeans.getRuntimeBeanEntries(), rpcs);
Deque<RuntimeBeanEntry> stack = new LinkedList<>();
stack.add(rootRuntimeBeanEntry);
while (stack.isEmpty() == false) {
RuntimeBeanEntry first = stack.pollFirst();
if (result.containsKey(first.getJavaNameOfRuntimeMXBean())) {
throw new NameConflictException(
first.getJavaNameOfRuntimeMXBean(), null, null);
}
result.put(first.getJavaNameOfRuntimeMXBean(), first);
stack.addAll(first.getChildren());
}
return result;
}
示例10: createRoot
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private static RuntimeBeanEntry createRoot(final String packageName,
final DataNodeContainer nodeForReporting, final String attributeYangName,
final List<AttributeIfc> attributes, final String javaNamePrefix,
final List<RuntimeBeanEntry> children, final Set<Rpc> rpcs) {
return new RuntimeBeanEntry(packageName, nodeForReporting,
attributeYangName, javaNamePrefix, true,
Optional.<String> absent(), attributes, children, rpcs);
}
示例11: AttributesRpcsAndRuntimeBeans
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
public AttributesRpcsAndRuntimeBeans(
final List<RuntimeBeanEntry> runtimeBeanEntries,
final List<AttributeIfc> attributes, final Set<Rpc> rpcs) {
this.runtimeBeanEntries = runtimeBeanEntries;
this.attributes = attributes;
this.rpcs = rpcs;
}
示例12: Rpc
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
Rpc(final AttributeIfc returnType, final String name, final String yangName,
final List<JavaAttribute> parameters) {
this.returnType = returnType;
this.name = name;
this.parameters = parameters;
this.yangName = yangName;
}
示例13: ModuleMXBeanEntry
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
ModuleMXBeanEntry(ModuleMXBeanEntryInitial initials, Map<String, AttributeIfc> yangToAttributes,
Map<String, QName> providedServices2, Collection<RuntimeBeanEntry> runtimeBeans) {
this.yangToAttributes = yangToAttributes;
this.providedServices = Collections.unmodifiableMap(providedServices2);
this.runtimeBeans = runtimeBeans;
this.initial = initials;
}
示例14: test_jmxImplModule
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
@Test
public void test_jmxImplModule() {
final Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
final Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
.create(this.threadsModule, PACKAGE_NAME,identitiesToSIs);
modulesToSIEs.putAll(ServiceInterfaceEntry.create(this.jmxModule,
PACKAGE_NAME,identitiesToSIs));
final Map<String /* identity local name */, ModuleMXBeanEntry> namesToMBEs = ModuleMXBeanEntry
.create(this.jmxImplModule, modulesToSIEs, this.context, new TypeProviderWrapper(new TypeProviderImpl(this.context))
, PACKAGE_NAME);
final Map<String, AttributeIfc> attributes = namesToMBEs.get("impl-netconf")
.getAttributes();
assertCorrectAttributesSize(namesToMBEs, attributes);
//
final DependencyAttribute threadFactoryAttribute = (DependencyAttribute) attributes
.get("thread-factory");
assertNotNull(threadFactoryAttribute);
assertFalse(threadFactoryAttribute.getDependency().isMandatory());
assertThat(threadFactoryAttribute.getDependency().getSie()
.getTypeName(), is("ThreadFactoryServiceInterface"));
assertThat(threadFactoryAttribute.getAttributeYangName(),
is("thread-factory"));
assertThat(threadFactoryAttribute.getLowerCaseCammelCase(),
is("threadFactory"));
assertThat(threadFactoryAttribute.getUpperCaseCammelCase(),
is("ThreadFactory"));
assertThat(threadFactoryAttribute.getOpenType(), isA(SimpleType.class));
assertNull(threadFactoryAttribute.getNullableDefault());
assertNull(threadFactoryAttribute.getNullableDescription());
assertThat(threadFactoryAttribute.getType().getName(), is("ObjectName"));
}
示例15: assertCorrectAttributesSize
import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入依赖的package包/类
private void assertCorrectAttributesSize(final Map<String, ModuleMXBeanEntry> namesToMBEs, final Map<String, AttributeIfc> attributes) {
assertEquals(14, attributes.size());
assertEquals(1, namesToMBEs.get("impl-netconf").getRuntimeBeans().size());
assertEquals(2, namesToMBEs.get("impl-netconf").getRuntimeBeans().iterator().next().getAttributes().size());
assertEquals(4, namesToMBEs.get("impl").getAttributes().size());
assertEquals(1, namesToMBEs.get("impl").getRuntimeBeans().size());
assertEquals(1, namesToMBEs.get("impl").getRuntimeBeans().iterator().next().getAttributes().size());
}