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


Java AttributeIfc.getUpperCaseCammelCase方法代码示例

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


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

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

示例2: getTOAndMXInterfaceFtlFiles

import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; //导入方法依赖的package包/类
/**
 * Get map of file name as key, FtlFile instance representing runtime mx
 * bean as value that should be persisted from this instance.
 */
public static Map<String, FtlTemplate> getTOAndMXInterfaceFtlFiles(
        final RuntimeBeanEntry entry) {
    final Map<String, FtlTemplate> result = new HashMap<>();
    { // create GeneralInterfaceFtlFile for runtime MXBean. Attributes will
      // be transformed to getter methods
        final String mxBeanTypeName = entry.getJavaNameOfRuntimeMXBean();
        final List<String> extendedInterfaces = Collections.singletonList(RuntimeBean.class
                .getCanonicalName());
        final List<MethodDeclaration> methods = new ArrayList<>();

        // convert attributes to getters
        for (final AttributeIfc attributeIfc : entry.getAttributes()) {
            String returnType;
            returnType = getReturnType(attributeIfc);
            final String getterName = "get"
                    + attributeIfc.getUpperCaseCammelCase();
            final MethodDeclaration getter = new MethodDeclaration(returnType,
                    getterName, Collections.<Field> emptyList());
            methods.add(getter);
        }

        // add rpc methods
        for (final Rpc rpc : entry.getRpcs()) {
            // convert JavaAttribute parameters into fields
            final List<Field> fields = new ArrayList<>();
            for (final JavaAttribute ja : rpc.getParameters()) {
                final Field field = new Field(Collections.emptyList(),
                        ja.getType().getFullyQualifiedName(),
                        ja.getLowerCaseCammelCase(), ja.getNullableDefaultWrappedForCode());
                fields.add(field);
            }
            final MethodDeclaration operation = new MethodDeclaration(
                    getReturnType(rpc.getReturnType()), rpc.getName(), fields);
            methods.add(operation);
        }

        // FIXME header
        final GeneralInterfaceTemplate runtimeMxBeanIfc = new GeneralInterfaceTemplate(
                null, entry.getPackageName(), mxBeanTypeName,
                extendedInterfaces, methods);

        result.put(runtimeMxBeanIfc.getTypeDeclaration().getName()
                + ".java", runtimeMxBeanIfc);
    }

    result.putAll(TemplateFactory.tOsFromRbe(entry));

    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:54,代码来源:TemplateFactory.java


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