當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotatedJavaType類代碼示例

本文整理匯總了Java中org.springframework.roo.classpath.details.annotations.AnnotatedJavaType的典型用法代碼示例。如果您正苦於以下問題:Java AnnotatedJavaType類的具體用法?Java AnnotatedJavaType怎麽用?Java AnnotatedJavaType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnnotatedJavaType類屬於org.springframework.roo.classpath.details.annotations包,在下文中一共展示了AnnotatedJavaType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createRequestParam

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * 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,代碼行數:31,代碼來源:WebItdBuilderHelper.java

示例2: getModalDialogMethod

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Returns MethodMetadata for:
 * <p>
 * <code>modalDialog(DialogType dialogType, String title, String description, HttpServletRequest httpServletRequest)</code>
 * 
 * @param aspectName
 * @return
 */
private MethodMetadata getModalDialogMethod() {
    // Specify the desired method name
    JavaSymbolName methodName = new JavaSymbolName("modalDialog");

    List<AnnotatedJavaType> paramTypes = getMethodParamTypes(false);

    MethodMetadata modalDialogMethod = methodExists(methodName, paramTypes);
    if (modalDialogMethod != null) {
        return modalDialogMethod;
    }

    List<JavaSymbolName> paramNames = getMethodParamNames(false);

    InvocableMemberBodyBuilder bodyBuilder = getMethodBodyBuilder(null);

    return new MethodMetadataBuilder(getId(), 0, methodName,
            JavaType.VOID_PRIMITIVE, paramTypes, paramNames, bodyBuilder)
            .build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:28,代碼來源:ModalDialogMetadata.java

示例3: getReferenceRequestParam

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Get the RequestParam annotation for gvnixreference.
 * <p>
 * Key has the param name and value has the annotation.
 * </p>
 * <code>@RequestParam(value = "gvnixreference", required = true) MasterEntityIdType gvnixreference</code>
 * 
 * @return Request param name and annotation
 */
protected Entry<JavaSymbolName, AnnotatedJavaType> getReferenceRequestParam() {

    AnnotationMetadataBuilder gvnixreferenceParamBuilder = new AnnotationMetadataBuilder(
            new JavaType(
                    "org.springframework.web.bind.annotation.RequestParam"));
    gvnixreferenceParamBuilder.addStringAttribute("value", GVNIX_REF);
    gvnixreferenceParamBuilder.addBooleanAttribute("required", true);
    List<AnnotationMetadata> gvnixreferenceParam = new ArrayList<AnnotationMetadata>();
    gvnixreferenceParam.add(gvnixreferenceParamBuilder.build());

    return new SimpleEntry<JavaSymbolName, AnnotatedJavaType>(
            new JavaSymbolName(GVNIX_REF), new AnnotatedJavaType(
                    new JavaType(masterEntityJavaDetails
                            .getPersistenceDetails().getIdentifierField()
                            .getFieldType().getFullyQualifiedTypeName()),
                    gvnixreferenceParam));
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:27,代碼來源:RelatedPatternMetadata.java

示例4: getPageRequestParam

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Get the RequestParam annotation for page pagination.
 * <p>
 * Key has the param name and value has the annotation.
 * </p>
 * <code>
 * 
 * @RequestParam(value = "fu_org_gvnix_tiendavirtual_domain_ProductoPage",
 *                     required = false) Integer page, </code>
 * @return Request param name and annotation
 */
protected Entry<JavaSymbolName, AnnotatedJavaType> getPageRequestParam() {

    AnnotationMetadataBuilder gvnixpatternParamBuilder = new AnnotationMetadataBuilder(
            new JavaType(RQST_PARAM_PATH));
    gvnixpatternParamBuilder.addStringAttribute(
            VALUE_TXT,
            XmlUtils.convertId("fu:" + entity.getFullyQualifiedTypeName()
                    + "Page"));
    gvnixpatternParamBuilder.addBooleanAttribute(REQUIRED_TXT, false);
    List<AnnotationMetadata> gvnixpatternParam = new ArrayList<AnnotationMetadata>();
    gvnixpatternParam.add(gvnixpatternParamBuilder.build());

    return new SimpleEntry<JavaSymbolName, AnnotatedJavaType>(
            new JavaSymbolName("page"), new AnnotatedJavaType(new JavaType(
                    "java.lang.Integer"), gvnixpatternParam));
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:28,代碼來源:AbstractPatternMetadata.java

示例5: getMethod

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Returns a public method given the method name, return type, parameter
 * types, parameter names, and method body.
 * 
 * @param methodName the method name
 * @param returnType the return type
 * @param parameterTypes a list of parameter types
 * @param parameterNames a list of parameter names
 * @param bodyBuilder the method body
 * @return null if the method exists on the governor, otherwise a new method
 *         is returned
 */
protected MethodMetadataBuilder getMethod(final int modifier,
        final JavaSymbolName methodName, final JavaType returnType,
        final List<JavaType> parameterTypes,
        final List<JavaSymbolName> parameterNames,
        final InvocableMemberBodyBuilder bodyBuilder) {
    final MethodMetadata method = getGovernorMethod(methodName,
            parameterTypes);
    if (method != null) {
        return null;
    }

    addToImports(parameterTypes);
    return new MethodMetadataBuilder(getId(), modifier, methodName,
            returnType,
            AnnotatedJavaType.convertFromJavaTypes(parameterTypes),
            parameterNames, bodyBuilder);
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:30,代碼來源:AbstractItdTypeDetailsProvidingMetadataItem.java

示例6: getDeclaredMethod

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Locates the specified method.
 * 
 * @param memberHoldingTypeDetails the {@link MemberHoldingTypeDetails} to
 *            search; can be <code>null</code>
 * @param methodName to locate; can be <code>null</code>
 * @param parameters to locate (can be null if there are no parameters)
 * @return the method, or <code>null</code> if the given name was
 *         <code>null</code> or it was simply not found
 */
public static MethodMetadata getDeclaredMethod(
        final MemberHoldingTypeDetails memberHoldingTypeDetails,
        final JavaSymbolName methodName, List<JavaType> parameters) {
    if (memberHoldingTypeDetails == null) {
        return null;
    }
    if (parameters == null) {
        parameters = new ArrayList<JavaType>();
    }
    for (final MethodMetadata method : memberHoldingTypeDetails
            .getDeclaredMethods()) {
        if (method.getMethodName().equals(methodName)) {
            final List<JavaType> parameterTypes = AnnotatedJavaType
                    .convertFromAnnotatedJavaTypes(method
                            .getParameterTypes());
            if (parameterTypes.equals(parameters)) {
                return method;
            }
        }
    }
    return null;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:33,代碼來源:MemberFindingUtils.java

示例7: getMethodParamTypes

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Returns the list of method parameter types.
 * 
 * @param addParamsParameter if true will define
 *        <code>HashMap&lt;String, Object&gt; params</code> parameter
 * @return
 */
private List<AnnotatedJavaType> getMethodParamTypes(
        boolean addParamsParameter) {
    List<AnnotatedJavaType> paramTypes = new ArrayList<AnnotatedJavaType>();

    JavaType dialogType = getJavaTypeForClassName("DialogType");
    paramTypes.add(new AnnotatedJavaType(dialogType,
            new ArrayList<AnnotationMetadata>()));
    paramTypes.add(new AnnotatedJavaType(JavaType.STRING,
            new ArrayList<AnnotationMetadata>()));
    paramTypes.add(new AnnotatedJavaType(JavaType.STRING,
            new ArrayList<AnnotationMetadata>()));
    if (addParamsParameter) {
        List<JavaType> typeParams = new ArrayList<JavaType>();
        typeParams.add(JavaType.STRING);
        typeParams.add(new JavaType("java.lang.Object"));
        JavaType hashMap = new JavaType("java.util.HashMap", 0,
                DataType.TYPE, null, typeParams);
        paramTypes.add(new AnnotatedJavaType(hashMap,
                new ArrayList<AnnotationMetadata>()));
    }
    paramTypes.add(new AnnotatedJavaType(new JavaType(
            "javax.servlet.http.HttpServletRequest"),
            new ArrayList<AnnotationMetadata>()));
    return paramTypes;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:33,代碼來源:ModalDialogMetadata.java

示例8: getNoArgConstructor

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Locates the no-arg constructor for this class, if available.
 * <p>
 * If a class defines a no-arg constructor, it is returned (irrespective of
 * access modifiers).
 * <p>
 * If a class does not define a no-arg constructor, one might be created. It
 * will only be created if the {@link RooIdentifier#noArgConstructor} is
 * true AND there is at least one other constructor declared in the source
 * file. If a constructor is created, it will have a private access
 * modifier.
 * 
 * @return the constructor (may return null if no constructor is to be
 *         produced)
 */
private ConstructorMetadataBuilder getNoArgConstructor() {
    // Search for an existing constructor
    final List<JavaType> parameterTypes = new ArrayList<JavaType>();
    final ConstructorMetadata result = governorTypeDetails
            .getDeclaredConstructor(parameterTypes);
    if (result != null) {
        // Found an existing no-arg constructor on this class
        return null;
    }

    // Create the constructor
    final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    bodyBuilder.appendFormalLine("super();");

    final ConstructorMetadataBuilder constructorBuilder = new ConstructorMetadataBuilder(
            getId());
    constructorBuilder.setModifier(publicNoArgConstructor ? Modifier.PUBLIC
            : Modifier.PRIVATE);
    constructorBuilder.setParameterTypes(AnnotatedJavaType
            .convertFromJavaTypes(parameterTypes));
    constructorBuilder.setBodyBuilder(bodyBuilder);
    return constructorBuilder;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:39,代碼來源:IdentifierMetadata.java

示例9: getCreateMethod

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
private MethodMetadata getCreateMethod() {
    JavaSymbolName methodName = new JavaSymbolName("create");

    MethodMetadata method = methodExists(methodName);
    if (method != null) {
        return method;
    }

    List<AnnotatedJavaType> paramTypes = new ArrayList<AnnotatedJavaType>();
    paramTypes.add(new AnnotatedJavaType(this.entity,
            new ArrayList<AnnotationMetadata>()));

    List<JavaSymbolName> paramNames = new ArrayList<JavaSymbolName>();
    paramNames.add(new JavaSymbolName(this.entityReference));

    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    bodyBuilder.appendFormalLine(this.entityReference
            + "."
            + new JpaCrudAnnotationValues(this.entityMetadata)
                    .getPersistMethod() + "();");
    bodyBuilder.appendFormalLine("return " + this.entityReference + ";");

    return new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName,
            this.entity, paramTypes, paramNames, bodyBuilder).build();
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:26,代碼來源:FlexScaffoldMetadata.java

示例10: getMethodParameterTypes

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Returns the list of Parameter Types for the methods
 * <p>
 * Returns a list containing:<br/>
 * <code>@Valid formBackingObjectList, BindingResult, HttpServletRequest</cod>
 * </p>
 * 
 * @return
 */
private List<AnnotatedJavaType> getMethodParameterTypes() {
    /*
     * Define method parameter types. (@Valid formBackingObjectList,
     * BindingResult, HttpServletRequest)
     */
    List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>();

    parameterTypes.add(getEntity(getEntityList()).getValue());
    parameterTypes.add(BINDING_RESULT.getValue());
    parameterTypes.add(HTTP_SERVLET_REQUEST_PARAM.getValue());

    return parameterTypes;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:23,代碼來源:AbstractPatternMetadata.java

示例11: methodExists

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Returns the method if exists or null otherwise. With this we assure that
 * a method is defined once in the Class
 * 
 * @param methodName
 * @param paramTypes
 * @return
 */
protected MethodMetadata methodExists(JavaSymbolName methodName,
        List<AnnotatedJavaType> paramTypes) {
    List<JavaType> nonAnnotatedJavaTypes = AnnotatedJavaType
            .convertFromAnnotatedJavaTypes(paramTypes);
    for (MethodMetadata methodMetadata : controllerMethods) {
        if (methodMetadata.getMethodName().equals(methodName)
                && nonAnnotatedJavaTypes.equals(AnnotatedJavaType
                        .convertFromAnnotatedJavaTypes(methodMetadata
                                .getParameterTypes()))) {
            return methodMetadata;
        }
    }
    return null;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:23,代碼來源:AbstractPatternMetadata.java

示例12: InvocableMemberMetadataCustomDataKey

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
protected InvocableMemberMetadataCustomDataKey(final Integer modifier,
        final List<AnnotationMetadata> annotations,
        final List<AnnotatedJavaType> parameterTypes,
        final List<JavaSymbolName> parameterNames,
        final List<JavaType> throwsTypes) {
    super(modifier, annotations);
    this.parameterTypes = parameterTypes;
    this.parameterNames = parameterNames;
    this.throwsTypes = throwsTypes;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:11,代碼來源:InvocableMemberMetadataCustomDataKey.java

示例13: getDeclaredConstructor

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
public ConstructorMetadata getDeclaredConstructor(
        final List<JavaType> parameters) {
    final Collection<JavaType> parameterList = CollectionUtils.populate(
            new ArrayList<JavaType>(), parameters);
    for (final ConstructorMetadata constructor : getDeclaredConstructors()) {
        if (parameterList.equals(AnnotatedJavaType
                .convertFromAnnotatedJavaTypes(constructor
                        .getParameterTypes()))) {
            return constructor;
        }
    }
    return null;
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:14,代碼來源:AbstractMemberHoldingTypeDetails.java

示例14: MethodMetadataBuilder

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
/**
 * Constructor for a method with parameters
 * 
 * @param declaredbyMetadataId
 * @param modifier
 * @param methodName
 * @param returnType
 * @param parameterTypes
 * @param parameterNames
 * @param bodyBuilder
 */
public MethodMetadataBuilder(final String declaredbyMetadataId,
        final int modifier, final JavaSymbolName methodName,
        final JavaType returnType,
        final List<AnnotatedJavaType> parameterTypes,
        final List<JavaSymbolName> parameterNames,
        final InvocableMemberBodyBuilder bodyBuilder) {
    this(declaredbyMetadataId);
    setModifier(modifier);
    setParameterTypes(parameterTypes);
    setParameterNames(parameterNames);
    init(methodName, returnType);
    setBodyBuilder(bodyBuilder);
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:25,代碼來源:MethodMetadataBuilder.java

示例15: getOnEditMethod

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType; //導入依賴的package包/類
private MethodMetadataBuilder getOnEditMethod() {
    final JavaSymbolName methodName = new JavaSymbolName("onEdit");
    if (governorHasMethod(methodName)) {
        return null;
    }

    final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    for (final FieldMetadata field : locatedFields) {
        final CustomData customData = field.getCustomData();
        if (!customData.keySet().contains(PARAMETER_TYPE_KEY)) {
            continue;
        }

        builder.getImportRegistrationResolver().addImport(ARRAY_LIST);

        final String fieldName = field.getFieldName().getSymbolName();
        final JavaType parameterType = (JavaType) customData
                .get(PARAMETER_TYPE_KEY);
        final String entityAccessorMethodCall = entityName.getSymbolName()
                + ".get" + StringUtils.capitalize(fieldName) + "()";

        bodyBuilder
                .appendFormalLine("if (" + entityName.getSymbolName()
                        + " != null && " + entityAccessorMethodCall
                        + " != null) {");
        bodyBuilder.indent();
        bodyBuilder.appendFormalLine(getSelectedFieldName(fieldName)
                + " = new ArrayList<" + parameterType.getSimpleTypeName()
                + ">(" + entityAccessorMethodCall + ");");
        bodyBuilder.indentRemove();
        bodyBuilder.appendFormalLine("}");
    }
    bodyBuilder.appendFormalLine("return null;");

    return new MethodMetadataBuilder(getId(), PUBLIC, methodName,
            JavaType.STRING, new ArrayList<AnnotatedJavaType>(),
            new ArrayList<JavaSymbolName>(), bodyBuilder);
}
 
開發者ID:gvSIGAssociation,項目名稱:gvnix1,代碼行數:39,代碼來源:JsfManagedBeanMetadata.java


注:本文中的org.springframework.roo.classpath.details.annotations.AnnotatedJavaType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。