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


Java AttributeIfc.getOpenType方法代码示例

本文整理汇总了Java中org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc.getOpenType方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeIfc.getOpenType方法的具体用法?Java AttributeIfc.getOpenType怎么用?Java AttributeIfc.getOpenType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc的用法示例。


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

示例1: switchAttribute

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
public T switchAttribute(final AttributeIfc attributeIfc) {

        this.lastAttribute = attributeIfc;

        OpenType<?> openType = attributeIfc.getOpenType();

        if (attributeIfc instanceof JavaAttribute) {
            try {
                if (((JavaAttribute) attributeIfc).getTypeDefinition() instanceof BinaryTypeDefinition) {
                    return caseJavaBinaryAttribute(openType);
                } else if (((JavaAttribute) attributeIfc).isUnion()) {
                    return caseJavaUnionAttribute(openType);
                } else if (((JavaAttribute) attributeIfc).isIdentityRef()) {
                    return caseJavaIdentityRefAttribute(openType);
                } else if (((JavaAttribute) attributeIfc).isEnum()) {
                    return caseJavaEnumAttribute(openType);
                } else {
                    return caseJavaAttribute(openType);
                }
            } catch (final UnknownOpenTypeException e) {
                throw getIllegalArgumentException(attributeIfc);
            }

        } else if (attributeIfc instanceof DependencyAttribute) {
            return caseDependencyAttribute(((DependencyAttribute) attributeIfc).getOpenType());
        } else if (attributeIfc instanceof ListAttribute) {
            return caseListAttribute((ArrayType<?>) openType);
        } else if (attributeIfc instanceof ListDependenciesAttribute) {
            return caseListDependeciesAttribute((ArrayType<?>) openType);
        } else if (attributeIfc instanceof TOAttribute) {
            return caseTOAttribute(((TOAttribute) attributeIfc).getOpenType());
        }

        throw getIllegalArgumentException(attributeIfc);
    }
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:36,代码来源:AttributeIfcSwitchStatement.java

示例2: getIllegalArgumentException

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
private IllegalArgumentException getIllegalArgumentException(final AttributeIfc attributeIfc) {
    return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc
            + " with open type:" + attributeIfc.getOpenType());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:AttributeIfcSwitchStatement.java

示例3: tOsFromRbe

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
public static Map<String, GeneralClassTemplate> tOsFromRbe(
        final RuntimeBeanEntry rbe) {
    final Map<String, GeneralClassTemplate> retVal = Maps.newHashMap();
    final TOAttributesProcessor processor = new TOAttributesProcessor();
    final Map<String, AttributeIfc> yangPropertiesToTypesMap = Maps.newHashMap(rbe.getYangPropertiesToTypesMap());

    // Add TOs from output parameters
    for (final Rpc rpc : rbe.getRpcs()) {
        final AttributeIfc returnType = rpc.getReturnType();

        if (returnType == VoidAttribute.getInstance()) {
            continue;
        }
        if (returnType instanceof JavaAttribute) {
            continue;
        }
        if ((returnType instanceof ListAttribute) && (returnType.getOpenType() instanceof SimpleType)) {
            continue;
        }

        Preconditions.checkState(!yangPropertiesToTypesMap.containsKey(returnType.getAttributeYangName()),
                "Duplicate TO %s for %s", returnType.getAttributeYangName(), rbe);
        yangPropertiesToTypesMap.put(returnType.getAttributeYangName(), returnType);
    }

    processor.processAttributes(yangPropertiesToTypesMap);
    for (final org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.TemplateFactory.TOAttributesProcessor.TOInternal to : processor
            .getTOs()) {
        final List<Constructor> constructors = Lists.newArrayList();
        constructors.add(new Constructor(to.getName(), "super();"));

        // TODO header
        retVal.put(
                to.getType(),
                new GeneralClassTemplate(null, rbe.getPackageName(), to
                        .getName(), Collections.<String> emptyList(),
                        Collections.<String> emptyList(), to.getFields(),
                        to.getMethods(), false, false, constructors));
    }
    return retVal;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:42,代码来源:TemplateFactory.java


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