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


Java FieldMetadata.getFieldInitializer方法代码示例

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


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

示例1: appendFields

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private void appendFields() {
    final List<? extends FieldMetadata> fields = itdTypeDetails
            .getDeclaredFields();
    if (fields == null || fields.isEmpty()) {
        return;
    }

    content = true;
    for (final FieldMetadata field : fields) {
        // Append annotations
        for (final AnnotationMetadata annotation : field.getAnnotations()) {
            appendIndent();
            outputAnnotation(annotation);
            this.newLine(false);
        }

        // Append "<modifier> <fieldType> <fieldName>" portion
        appendIndent();
        if (field.getModifier() != 0) {
            append(Modifier.toString(field.getModifier()));
            append(" ");
        }
        append(field.getFieldType().getNameIncludingTypeParameters(false,
                resolver));
        append(" ");
        append(introductionTo.getSimpleTypeName());
        append(".");
        append(field.getFieldName().getSymbolName());

        // Append initializer, if present
        if (field.getFieldInitializer() != null) {
            append(" = ");
            append(field.getFieldInitializer());
        }

        // Complete the field declaration
        append(";");
        this.newLine(false);
        this.newLine();
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:42,代码来源:ItdSourceFileComposer.java

示例2: getGvNIXXmlElementFieldAnnotation

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
/**
 * <p>
 * Convert field with @XmlElement annotation to field with @GvNIXXmlElementField
 * with its values.
 * </p>
 * <p>
 * Creates {@link FieldMetadata} with @GvNIXXmlElementField annotation even
 * if not exists @XmlElement.
 * </p>
 * TODO to be removed from interface?. This method could be useless outside
 * this service.
 * 
 * @param fieldMetadata
 * @return {@link FieldMetadata} with @GvNIXXmlElementField annotation.
 */
protected FieldMetadata getGvNIXXmlElementFieldAnnotation(
        FieldMetadata field) {

    AnnotationMetadata gvNixXmlElementAnnot;

    AnnotationMetadata xmlElementAnnot = MemberFindingUtils
            .getAnnotationOfType(field.getAnnotations(), new JavaType(
                    XmlElement.class.getName()));
    if (xmlElementAnnot != null) {

        // Field has XmlElement annotation: create GvNIXXmlElement from it
        gvNixXmlElementAnnot = getXmlElementFieldAnnotation(xmlElementAnnot);

    }
    else {

        AnnotationMetadata xmlElementRefAnnot = MemberFindingUtils
                .getAnnotationOfType(field.getAnnotations(), new JavaType(
                        XmlElementRef.class.getName()));
        if (xmlElementRefAnnot != null) {

            // Field has XmlElementRef: create GvNIXXmlElement from it
            gvNixXmlElementAnnot = getXmlElementRefFieldAnnotation(field);

        }
        else {

            // Field no XmlElement, XmlElementRef: create empty
            // GvNIXXmlElement
            gvNixXmlElementAnnot = new AnnotationMetadataBuilder(
                    new JavaType(GvNIXXmlElementField.class.getName()),
                    new ArrayList<AnnotationAttributeValue<?>>()).build();
        }
    }

    List<AnnotationMetadata> annots = new ArrayList<AnnotationMetadata>();
    annots.add(gvNixXmlElementAnnot);

    // Create new Field with GvNIXAnnotation.
    FieldMetadataBuilder fieldMetadataBuilder = new FieldMetadataBuilder(
            field.getDeclaredByMetadataId(), field.getModifier(),
            field.getFieldName(), field.getFieldType(),
            field.getFieldInitializer());
    for (AnnotationMetadata annotationMetadata : annots) {
        fieldMetadataBuilder.addAnnotation(annotationMetadata);
    }

    return fieldMetadataBuilder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:65,代码来源:WSExportWsdlImpl.java


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