Package org.springframework.roo.model

Examples of org.springframework.roo.model.JavaSymbolName


        columnBuilder.addStringAttribute("name", "id");
        columnBuilder.addBooleanAttribute("nullable", false);
        annotations.add(columnBuilder);

        fieldBuilders.add(new FieldMetadataBuilder(getId(), Modifier.PRIVATE,
                annotations, new JavaSymbolName("id"), LONG_OBJECT));

        return fieldBuilders;
    }
View Full Code Here


            final List<FieldMetadataBuilder> fields) {
        final List<MethodMetadataBuilder> mutators = new ArrayList<MethodMetadataBuilder>();

        // Compute the names of the mutators that will be produced
        for (final FieldMetadataBuilder field : fields) {
            final JavaSymbolName requiredMutatorName = BeanInfoUtils
                    .getMutatorMethodName(field.getFieldName());
            final JavaType parameterType = field.getFieldType();
            final MethodMetadata mutator = getGovernorMethod(
                    requiredMutatorName, parameterType);
            if (mutator == null) {
                mutators.add(getMutatorMethod(field.getFieldName(),
                        field.getFieldType()));
            }
            else {
                Validate.isTrue(
                        Modifier.isPublic(mutator.getModifier()),
                        "User provided field but failed to provide a public '%s(%s)' method in '%s'",
                        requiredMutatorName.getSymbolName(), field
                                .getFieldName().getSymbolName(), destination
                                .getFullyQualifiedTypeName());
                mutators.add(new MethodMetadataBuilder(mutator));
            }
        }
View Full Code Here

            temporalType = "TIMESTAMP"; // ROO-2606
        }
        final AnnotationMetadataBuilder temporalBuilder = new AnnotationMetadataBuilder(
                TEMPORAL);
        temporalBuilder.addEnumAttribute("value", new EnumDetails(
                TEMPORAL_TYPE, new JavaSymbolName(temporalType)));
        annotations.add(temporalBuilder);

        final AnnotationMetadataBuilder dateTimeFormatBuilder = new AnnotationMetadataBuilder(
                DATE_TIME_FORMAT);
        dateTimeFormatBuilder.addStringAttribute("style", "M-");
View Full Code Here

        fullTypeParameters.addAll(typeParameterNames);
        final List<TypeParameter> params = constructorDeclaration
                .getTypeParameters();
        if (params != null) {
            for (final TypeParameter candidate : params) {
                final JavaSymbolName currentTypeParam = new JavaSymbolName(
                        candidate.getName());
                fullTypeParameters.add(currentTypeParam);
            }
        }

        // Get the body
        body = constructorDeclaration.getBlock().toString();
        body = StringUtils.replace(body, "{", "", 1);
        body = body.substring(0, body.lastIndexOf("}"));

        // Lookup the parameters and their names
        if (constructorDeclaration.getParameters() != null) {
            for (final Parameter p : constructorDeclaration.getParameters()) {
                final Type pt = p.getType();
                final JavaType parameterType = JavaParserUtils.getJavaType(
                        compilationUnitServices, pt, fullTypeParameters);

                final List<AnnotationExpr> annotationsList = p.getAnnotations();
                final List<AnnotationMetadata> annotations = new ArrayList<AnnotationMetadata>();
                if (annotationsList != null) {
                    for (final AnnotationExpr candidate : annotationsList) {
                        final JavaParserAnnotationMetadataBuilder md = JavaParserAnnotationMetadataBuilder
                                .getInstance(candidate, compilationUnitServices);
                        annotations.add(md.build());
                    }
                }

                parameterTypes.add(new AnnotatedJavaType(parameterType,
                        annotations));
                parameterNames.add(new JavaSymbolName(p.getId().getName()));
            }
        }

        if (constructorDeclaration.getAnnotations() != null) {
            for (final AnnotationExpr annotation : constructorDeclaration
View Full Code Here

                    .getId().getArrayCount() + fieldType.getArray(),
                    fieldType.getDataType(), fieldType.getArgName(),
                    fieldType.getParameters());
        }

        fieldName = new JavaSymbolName(var.getId().getName());

        // Lookup initializer, if one was requested and easily determinable
        final Expression e = var.getInit();
        if (e != null) {
            fieldInitializer = e.toString();
View Full Code Here

        cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
                RooJavaType.ROO_TO_STRING));

        final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>();
        if (!idType.equals(JdkJavaType.BIG_INTEGER)) {
            attributes.add(new ClassAttributeValue(new JavaSymbolName(
                    "identifierType"), idType));
        }
        cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
                RooJavaType.ROO_MONGO_ENTITY, attributes));
        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
View Full Code Here

        // Build interface type
        final AnnotationMetadataBuilder interfaceAnnotationMetadata = new AnnotationMetadataBuilder(
                ROO_REPOSITORY_MONGO);
        interfaceAnnotationMetadata.addAttribute(new ClassAttributeValue(
                new JavaSymbolName("domainType"), domainType));
        final String interfaceMdId = PhysicalTypeIdentifier.createIdentifier(
                interfaceType, pathResolver.getPath(interfaceIdentifier));
        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                interfaceMdId, Modifier.PUBLIC, interfaceType,
                PhysicalTypeCategory.INTERFACE);
        cidBuilder.addAnnotation(interfaceAnnotationMetadata.build());
        final JavaType listType = new JavaType(List.class.getName(), 0,
                DataType.TYPE, null, Arrays.asList(domainType));
        cidBuilder.addMethod(new MethodMetadataBuilder(interfaceMdId, 0,
                new JavaSymbolName("findAll"), listType,
                new InvocableMemberBodyBuilder()));
        typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
    }
View Full Code Here

        short index = 1;
        final AnnotationMetadata min = MemberFindingUtils.getAnnotationOfType(
                field.getAnnotations(), MIN);
        if (min != null) {
            final AnnotationAttributeValue<?> value = min
                    .getAttribute(new JavaSymbolName("value"));
            if (value != null) {
                index = new Short(value.getValue().toString());
            }
        }
        final JavaType fieldType = field.getFieldType();
        if (field.getFieldName().getSymbolName().contains("email")
                || field.getFieldName().getSymbolName().contains("Email")) {
            initializer = "some@email.com";
        }
        else if (fieldType.equals(JavaType.STRING)) {
            initializer = "some"
                    + field.getFieldName()
                            .getSymbolNameCapitalisedFirstLetter() + index;
        }
        else if (fieldType.equals(new JavaType(Date.class.getName()))
                || fieldType.equals(new JavaType(Calendar.class.getName()))) {
            final Calendar cal = Calendar.getInstance();
            AnnotationMetadata dateTimeFormat = null;
            String style = null;
            if ((dateTimeFormat = MemberFindingUtils.getAnnotationOfType(
                    field.getAnnotations(), DATE_TIME_FORMAT)) != null) {
                final AnnotationAttributeValue<?> value = dateTimeFormat
                        .getAttribute(new JavaSymbolName("style"));
                if (value != null) {
                    style = value.getValue().toString();
                }
            }
            if (MemberFindingUtils.getAnnotationOfType(field.getAnnotations(),
View Full Code Here

            if (!fieldType.isCommonCollectionType()
                    && !isSpecialType(fieldType)) {
                final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                        field);
                final String fieldName = field.getFieldName().getSymbolName();
                fieldBuilder.setFieldName(new JavaSymbolName(fieldName + "."
                        + fieldName));
                tbody.appendChild(typeCommand(document, fieldBuilder.build()));
            }
        }
View Full Code Here

        XmlUtils.findRequiredElement("/html/body/table", root).appendChild(tr);

        fileManager.createOrUpdateTextFileIfRequired(seleniumPath,
                XmlUtils.nodeToString(suite), false);

        menuOperations.addMenuItem(new JavaSymbolName("SeleniumTests"),
                new JavaSymbolName("Test"), "Test", "selenium_menu_test_suite",
                "/resources/" + relativeTestFilePath, "si_",
                pathResolver.getFocusedPath(Path.SRC_MAIN_WEBAPP));
    }
View Full Code Here

TOP

Related Classes of org.springframework.roo.model.JavaSymbolName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.