Package org.springframework.roo.classpath.details

Examples of org.springframework.roo.classpath.details.MethodMetadataBuilder


        if (method != null) {
            return null;
        }

        addToImports(parameterTypes);
        return new MethodMetadataBuilder(getId(), modifier, methodName,
                returnType,
                AnnotatedJavaType.convertFromJavaTypes(parameterTypes),
                parameterNames, bodyBuilder);
    }
View Full Code Here


                + identifierAccessorMethod.getMethodName().getSymbolName()
                + "());");

        persistMethod.copyAdditionsTo(builder, governorTypeDetails);

        final MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
                getId(), Modifier.PUBLIC, methodName, JavaType.VOID_PRIMITIVE,
                bodyBuilder);
        methodBuilder.setAnnotations(annotations);
        return methodBuilder;
    }
View Full Code Here

                + findMethod.getMethodCall() + ");");

        removeMethod.copyAdditionsTo(builder, governorTypeDetails);
        findMethod.copyAdditionsTo(builder, governorTypeDetails);

        final MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(
                getId(), Modifier.PUBLIC, methodName, JavaType.VOID_PRIMITIVE,
                bodyBuilder);
        methodBuilder.setAnnotations(annotations);
        return methodBuilder;
    }
View Full Code Here

        }
    }

    @Override
    public MethodMetadata build() {
        final MethodMetadataBuilder methodMetadataBuilder = new MethodMetadataBuilder(
                declaredByMetadataId);
        methodMetadataBuilder.setMethodName(methodName);
        methodMetadataBuilder.setReturnType(returnType);
        methodMetadataBuilder.setAnnotations(annotations);
        methodMetadataBuilder.setBodyBuilder(InvocableMemberBodyBuilder
                .getInstance().append(body));
        methodMetadataBuilder.setModifier(modifier);
        methodMetadataBuilder.setParameterNames(parameterNames);
        methodMetadataBuilder.setParameterTypes(parameterTypes);
        methodMetadataBuilder.setThrowsTypes(throwsTypes);
        return methodMetadataBuilder.build();
    }
View Full Code Here

                Validate.isTrue(
                        Modifier.isPublic(accessor.getModifier()),
                        "User provided field but failed to provide a public '%s()' method in '%s'",
                        requiredAccessorName.getSymbolName(),
                        destination.getFullyQualifiedTypeName());
                accessors.add(new MethodMetadataBuilder(accessor));
            }
        }
        return accessors;
    }
View Full Code Here

                        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));
            }
        }
        return mutators;
    }
View Full Code Here

            }
        }
    }

    public MethodMetadata build() {
        final MethodMetadataBuilder methodMetadataBuilder = new MethodMetadataBuilder(
                declaredByMetadataId);
        methodMetadataBuilder.setMethodName(methodName);
        methodMetadataBuilder.setReturnType(returnType);
        methodMetadataBuilder.setAnnotations(annotations);
        methodMetadataBuilder.setBodyBuilder(InvocableMemberBodyBuilder
                .getInstance().append(body));
        methodMetadataBuilder.setModifier(modifier);
        methodMetadataBuilder.setParameterNames(parameterNames);
        methodMetadataBuilder.setParameterTypes(parameterTypes);
        methodMetadataBuilder.setThrowsTypes(throwsTypes);
        return methodMetadataBuilder.build();
    }
View Full Code Here

                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

    // Add getters and setters
    for (final Entry<FieldMetadata, JavaSymbolName> entry : declaredFields
        .entrySet()) {
      final FieldMetadata field = entry.getKey();
      final MethodMetadataBuilder accessorMethod = getDeclaredGetter(field);
      final MethodMetadataBuilder mutatorMethod = getDeclaredSetter(field);

      // Check to see if GAE is interested
      if (entry.getValue() != null) {
        JavaSymbolName hiddenIdFieldName;
        if (field.getFieldType().isCommonCollectionType()) {
          hiddenIdFieldName = governorTypeDetails
              .getUniqueFieldName(field.getFieldName()
                  .getSymbolName() + "Keys");
          builder.getImportRegistrationResolver().addImport(
              GAE_DATASTORE_KEY_FACTORY);
          builder.addField(getMultipleEntityIdField(hiddenIdFieldName));
        } else {
          hiddenIdFieldName = governorTypeDetails
              .getUniqueFieldName(field.getFieldName()
                  .getSymbolName() + "Id");
          builder.addField(getSingularEntityIdField(hiddenIdFieldName));
        }

        processGaeAnnotations(field);

        accessorMethod.setBodyBuilder(getGaeAccessorBody(field,
            hiddenIdFieldName));
        mutatorMethod.setBodyBuilder(getGaeMutatorBody(field,
            hiddenIdFieldName));
      }

      builder.addMethod(accessorMethod);
      builder.addMethod(mutatorMethod);
    }

    // Implements interface methods if exists
    if (interfaceMethods != null) {
      for (MethodMetadata interfaceMethod : interfaceMethods) {
        MethodMetadataBuilder methodBuilder = getInterfaceMethod(interfaceMethod);
        builder.addMethod(methodBuilder);
      }
    }

    // Create a representation of the desired output ITD
View Full Code Here

        && !Modifier.isStatic(field.getModifier())) {
      final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
      bodyBuilder.appendFormalLine("return this."
          + field.getFieldName().getSymbolName() + ";");

      return new MethodMetadataBuilder(getId(), Modifier.PUBLIC,
          methodName, field.getFieldType(), bodyBuilder);
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of org.springframework.roo.classpath.details.MethodMetadataBuilder

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.