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


Java AttributeIfc.getClass方法代码示例

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


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

示例1: getReturnType

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
private static String getReturnType(final AttributeIfc attributeIfc) {
    String returnType;
    if (attributeIfc instanceof TypedAttribute) {
        final Type type = ((TypedAttribute) attributeIfc).getType();
        returnType = serializeType(type);
    } else if (attributeIfc == VoidAttribute.getInstance()) {
        return "void";
    } else {
        throw new UnsupportedOperationException(
                "Attribute not supported: "
                        + attributeIfc.getClass());
    }
    return returnType;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:TemplateFactory.java

示例2: processAttributes

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
void processAttributes(final Map<String, AttributeIfc> attributes) {
    for (final Entry<String, AttributeIfc> attrEntry : attributes.entrySet()) {
        String returnType;
        final AttributeIfc attributeIfc = attrEntry.getValue();

        if (attributeIfc instanceof TypedAttribute) {
            final TypedAttribute typedAttribute = (TypedAttribute) attributeIfc;
            returnType = serializeType(typedAttribute.getType());

            if ((attributeIfc instanceof JavaAttribute) && ((JavaAttribute)attrEntry.getValue()).isIdentityRef()) {
                returnType = serializeType(identityRefType);
            }

        } else {
            throw new UnsupportedOperationException(
                    "Attribute not supported: "
                            + attributeIfc.getClass());
        }

        final String getterName = "get"
                + attributeIfc.getUpperCaseCammelCase();
        final MethodDeclaration getter = new MethodDeclaration(returnType,
                getterName, Collections.<Field> emptyList());

        final String varName = BindingMapping.getPropertyName(attrEntry.getKey());
        final String setterName = "set"
                + attributeIfc.getUpperCaseCammelCase();
        final MethodDeclaration setter = new MethodDeclaration("void",
                setterName, Lists.newArrayList(new Field(returnType,
                        varName)));

        this.methods.add(getter);
        this.methods.add(setter);

        if (attributeIfc.getNullableDescription() != null) {
            setter.setJavadoc(attrEntry.getValue()
                    .getNullableDescription());
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:41,代码来源:TemplateFactory.java

示例3: 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


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