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


Java SpringJavaType.REQUEST_PARAM属性代码示例

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


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

示例1: createRequestParam

/**
 * Creates a "RequestParam" annotated type
 * 
 * @param paramType
 * @param value (optional) "value" attribute value
 * @param required (optional) attribute value
 * @param defaultValue (optional) attribute value
 * @return
 */
public AnnotatedJavaType createRequestParam(JavaType paramType,
        String value, Boolean required, String defaultValue) {
    // create annotation values
    final List<AnnotationAttributeValue<?>> annotationAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    if (StringUtils.isNotBlank(value)) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), value));
    }
    if (required != null) {
        annotationAttributes.add(new BooleanAttributeValue(
                new JavaSymbolName("required"), required.booleanValue()));
    }
    if (defaultValue != null) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("defaultValue"), defaultValue));
    }
    AnnotationMetadataBuilder paramAnnotationBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM, annotationAttributes);
    return new AnnotatedJavaType(paramType, paramAnnotationBuilder.build());
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:29,代码来源:GvNIXFancyTreeMetadata.java

示例2: createRequestParam

/**
 * Creates a "RequestParam" annotated type
 *
 * @param paramType
 * @param value (optional) "value" attribute value
 * @param required (optional) attribute value
 * @param defaultValue (optional) attribute value
 * @return
 */
public AnnotatedJavaType createRequestParam(JavaType paramType,
        String value, Boolean required, String defaultValue) {
    // create annotation values
    final List<AnnotationAttributeValue<?>> annotationAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    if (StringUtils.isNotBlank(value)) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), value));
    }
    if (required != null) {
        annotationAttributes.add(new BooleanAttributeValue(
                new JavaSymbolName("required"), required.booleanValue()));
    }
    if (defaultValue != null) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("defaultValue"), defaultValue));
    }
    AnnotationMetadataBuilder paramAnnotationBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM, annotationAttributes);

    return new AnnotatedJavaType(paramType, paramAnnotationBuilder.build());
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:30,代码来源:WebItdBuilderHelper.java

示例3: createDateTimeRequestParam

/**
 * Creates a "RequestParam" annotated type including DateTimeFormat annotation for Date fields.
 *
 * @param paramType
 * @param value (optional) "value" attribute value
 * @param required (optional) attribute value
 * @param defaultValue (optional) attribute value
 * @param dateTimeFormatAnnotation DateTimeFormat annotation metadata from referred Date field
 * @return
 */
public AnnotatedJavaType createDateTimeRequestParam(JavaType paramType,
        String value, Boolean required, String defaultValue,
        AnnotationMetadata dateTimeFormatAnnotation) {
    // create annotation values
    final List<AnnotationAttributeValue<?>> annotationAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    if (StringUtils.isNotBlank(value)) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), value));
    }
    if (required != null) {
        annotationAttributes.add(new BooleanAttributeValue(
                new JavaSymbolName("required"), required.booleanValue()));
    }
    if (defaultValue != null) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("defaultValue"), defaultValue));
    }
    AnnotationMetadataBuilder paramAnnotationBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM, annotationAttributes);

    return new AnnotatedJavaType(paramType, paramAnnotationBuilder.build(),
            dateTimeFormatAnnotation);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:WebItdBuilderHelper.java

示例4: createDateTimeRequestParam

/**
 * Creates a "RequestParam" annotated type including DateTimeFormat
 * annotation for Date fields.
 * 
 * @param paramType
 * @param value (optional) "value" attribute value
 * @param required (optional) attribute value
 * @param defaultValue (optional) attribute value
 * @param dateTimeFormatAnnotation DateTimeFormat annotation metadata from
 *        referred Date field
 * @return
 */
public AnnotatedJavaType createDateTimeRequestParam(JavaType paramType,
        String value, Boolean required, String defaultValue,
        AnnotationMetadata dateTimeFormatAnnotation) {
    // create annotation values
    final List<AnnotationAttributeValue<?>> annotationAttributes = new ArrayList<AnnotationAttributeValue<?>>();
    if (StringUtils.isNotBlank(value)) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("value"), value));
    }
    if (required != null) {
        annotationAttributes.add(new BooleanAttributeValue(
                new JavaSymbolName("required"), required.booleanValue()));
    }
    if (defaultValue != null) {
        annotationAttributes.add(new StringAttributeValue(
                new JavaSymbolName("defaultValue"), defaultValue));
    }
    AnnotationMetadataBuilder paramAnnotationBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM, annotationAttributes);

    return new AnnotatedJavaType(paramType, paramAnnotationBuilder.build(),
            dateTimeFormatAnnotation);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix,代码行数:35,代码来源:WebItdBuilderHelper.java

示例5: getShowOnlyListMethod

/**
 * Gets <code>showOnlyList</code> method. <br>
 * 
 * @return
 */
private MethodMetadata getShowOnlyListMethod(String plural) {
    // Define method parameter types
    List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>();

    parameterTypes.add(AnnotatedJavaType
            .convertFromJavaType(SpringJavaType.MODEL));
    parameterTypes.add(AnnotatedJavaType.convertFromJavaType(new JavaType(
            "javax.servlet.http.HttpServletRequest")));
    // @RequestParam("path") String listPath
    AnnotationMetadataBuilder listPathAnnotation = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM);
    listPathAnnotation.addStringAttribute("value", "path");
    parameterTypes.add(new AnnotatedJavaType(JavaType.STRING,
            listPathAnnotation.build()));

    // Define method parameter names
    List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>();
    parameterNames.add(new JavaSymbolName("uiModel"));
    parameterNames.add(new JavaSymbolName("request"));
    parameterNames.add(new JavaSymbolName("listPath"));

    // Check if a method with the same signature already exists in the
    // target type
    final MethodMetadata method = methodExists(SHOW_ONLY_LIST,
            parameterTypes);
    if (method != null) {
        // If it already exists, just return the method and omit its
        // generation via the ITD
        return method;
    }

    // Define method annotations
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();

    AnnotationMetadataBuilder requestMappingMetadataBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_MAPPING);

    // @RequestMapping(params = "selector", produces = "text/html")
    requestMappingMetadataBuilder.addStringAttribute("params",
            "mapselector");
    requestMappingMetadataBuilder.addStringAttribute("produces",
            "text/html");

    annotations.add(requestMappingMetadataBuilder);

    // Define method throws types
    List<JavaType> throwsTypes = new ArrayList<JavaType>();

    // Create the method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    buildShowOnlyListMethodBody(plural, bodyBuilder);

    // Use the MethodMetadataBuilder for easy creation of MethodMetadata
    MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
            getId(), Modifier.PUBLIC, SHOW_ONLY_LIST, JavaType.STRING,
            parameterTypes, parameterNames, bodyBuilder);
    methodBuilder.setAnnotations(annotations);
    methodBuilder.setThrowsTypes(throwsTypes);

    return methodBuilder.build(); // Build and return a MethodMetadata
    // instance
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:67,代码来源:GvNIXWebEntityMapLayerMetadata.java

示例6: getShowOnlyListMethod

/**
 * Gets <code>showOnlyList</code> method. <br>
 * 
 * @return
 */
private MethodMetadata getShowOnlyListMethod(JavaType entity) {
    // Define method parameter types
    List<AnnotatedJavaType> parameterTypes = AnnotatedJavaType
            .convertFromJavaTypes(new JavaType(
                    "org.springframework.ui.Model"), new JavaType(
                    "javax.servlet.http.HttpServletRequest"));

    AnnotationMetadataBuilder pathMetadataBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_PARAM);
    pathMetadataBuilder.addStringAttribute(VALUE_LABEL, "path");

    parameterTypes.add(new AnnotatedJavaType(JavaType.STRING,
            pathMetadataBuilder.build()));

    // Check if a method with the same signature already exists in the
    // target type
    final MethodMetadata method = methodExists(SHOW_ONLY_METHOD_NAME,
            parameterTypes);
    if (method != null) {
        // If it already exists, just return the method and omit its
        // generation via the ITD
        return method;
    }

    // Define method annotations
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();

    AnnotationMetadataBuilder requestMappingMetadataBuilder = new AnnotationMetadataBuilder(
            SpringJavaType.REQUEST_MAPPING);

    requestMappingMetadataBuilder.addStringAttribute("params", "selector");
    requestMappingMetadataBuilder.addStringAttribute("produces",
            "text/html");

    annotations.add(requestMappingMetadataBuilder);

    // Define method throws types
    List<JavaType> throwsTypes = new ArrayList<JavaType>();

    // Define method parameter names
    List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>();
    parameterNames.add(new JavaSymbolName("uiModel"));
    parameterNames.add(new JavaSymbolName("request"));
    parameterNames.add(new JavaSymbolName("listPath"));

    // Create the method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    buildShowOnlyListMethodBody(bodyBuilder, entity);

    // Use the MethodMetadataBuilder for easy creation of MethodMetadata
    MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
            getId(), Modifier.PUBLIC, SHOW_ONLY_METHOD_NAME,
            JavaType.STRING, parameterTypes, parameterNames, bodyBuilder);
    methodBuilder.setAnnotations(annotations);
    methodBuilder.setThrowsTypes(throwsTypes);

    return methodBuilder.build(); // Build and return a MethodMetadata
    // instance
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:64,代码来源:LoupefieldMetadata.java


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