List of usage examples for java.lang.reflect Modifier PUBLIC
int PUBLIC
To view the source code for java.lang.reflect Modifier PUBLIC.
Click Source Link
From source file:org.gvnix.addon.jpa.addon.audit.JpaAuditMetadata.java
/** * @return gets or creates// w ww .java2 s . c o m * findXXXRevisonByDates(fromDate,toDate,filter,order,start,limit) * method */ private MethodMetadata getFindRevisionByDatesMethod() { // method name JavaSymbolName methodName = findRevisionsByDatesMethodName; // Define method parameter types List<AnnotatedJavaType> parameterTypes = helper.toAnnotedJavaType(JdkJavaType.DATE, JdkJavaType.DATE, MAP_STRING_OBJECT, LIST_STRING, JavaType.INT_OBJECT, JavaType.INT_OBJECT); // Check if a method exist in type final MethodMetadata method = helper.methodExists(methodName, parameterTypes); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names (none in this case) List<JavaSymbolName> parameterNames = helper.toSymbolName("fromDate", "toDate", "filterMap", "order", "start", "limit"); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); revisionLogBuilder.buildBodyFindRevisionByDates(bodyBuilder, parameterNames); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC + Modifier.STATIC, methodName, revisonItemListType, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata }
From source file:org.gvnix.addon.geo.addon.GvNIXGeoConversionServiceMetadata.java
/** * Gets <code>getGeometryToStringConverter</code> method. <br> * //from w ww. j a va 2 s . c o m * @return */ private MethodMetadata getGeometryToStringConverterMethod() { // Define method parameter types List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>(); // Check if a method with the same signature already exists in the // target type final MethodMetadata method = methodExists(GEOMETRY_TO_STRING_METHOD, 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>(); // Define method throws types List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>(); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); buildGetGeometryToStringConverterMethodBody(bodyBuilder); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, GEOMETRY_TO_STRING_METHOD, CONVERTER_GEOMETRY_STRING, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata // instance }
From source file:org.gvnix.web.screen.roo.addon.RelatedPatternMetadata.java
protected MethodMetadata getUpdateMethod(String patternName) { // Specify the desired method name JavaSymbolName methodName = new JavaSymbolName("updatePattern" + patternName); List<JavaSymbolName> methodParamNames = new ArrayList<JavaSymbolName>(); List<AnnotatedJavaType> methodParamTypes = new ArrayList<AnnotatedJavaType>(); getRequestParam(methodParamNames, methodParamTypes); MethodMetadata method = methodExists(methodName, methodParamTypes); if (method != null) { // If it already exists, just return null and omit its generation // via the ITD return null; }//from w w w .j a v a2s. com // Create method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); String entityNamePlural = entityTypeDetails.getPlural(); bodyBuilder.appendFormalLine("update(".concat(entity.getSimpleTypeName().toLowerCase()) .concat(", bindingResult, uiModel, httpServletRequest);")); bodyBuilder.appendFormalLine("if ( bindingResult.hasErrors() ) {"); bodyBuilder.indent(); addBodyLinesForDialogBinding(bodyBuilder, DialogType.Error, "message_errorbinding_problemdescription"); bodyBuilder.appendFormalLine(RETURN_QUOTE.concat(entityNamePlural.toLowerCase()).concat("/update\";")); bodyBuilder.indentRemove(); bodyBuilder.appendFormalLine("}"); bodyBuilder.appendFormalLine( RETURN_QUOTE.concat("redirect:/").concat(masterEntityJavaDetails.getPlural().toLowerCase()) .concat("?gvnixform&\" + refererQuery(httpServletRequest);")); MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName, JavaType.STRING, methodParamTypes, methodParamNames, bodyBuilder); methodBuilder.setAnnotations(getRequestMappingAnnotationCreateUpdate(RequestMethod.PUT, patternName)); method = methodBuilder.build(); controllerMethods.add(method); return method; }
From source file:org.gvnix.addon.jpa.addon.batch.JpaBatchMetadata.java
/** * Return method <code>deleteAll</code> * //from w w w . ja v a 2 s . co m * @return */ private MethodMetadata getDeleteAllMethod() { // method name JavaSymbolName methodName = DELETE_ALL_METHOD; // Check if a method exist in type final MethodMetadata method = methodExists(methodName, new ArrayList<AnnotatedJavaType>()); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); annotations.add(new AnnotationMetadataBuilder(SpringJavaType.TRANSACTIONAL)); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter types (none in this case) List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>(); // Define method parameter names (none in this case) List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>(); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); buildDeleteAllMethodBody(bodyBuilder); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName, JavaType.INT_PRIMITIVE, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata // instance }
From source file:org.gvnix.addon.jpa.addon.audit.JpaAuditMetadata.java
/** * @return gets or creates getXXXRevisions(fromData,toDate,start,limit) * instance method/*from ww w.jav a 2 s . c o m*/ */ private MethodMetadata getGetRevisionsInstanceMethod() { // method name JavaSymbolName methodName = getRevisionsMethodName; // Define method parameter types List<AnnotatedJavaType> parameterTypes = helper.toAnnotedJavaType(JdkJavaType.DATE, JdkJavaType.DATE, JavaType.INT_OBJECT, JavaType.INT_OBJECT); // Check if a method exist in type final MethodMetadata method = helper.methodExists(methodName, parameterTypes); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names (none in this case) List<JavaSymbolName> parameterNames = helper.toSymbolName("fromDate", "toDate", "start", "limit"); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); revisionLogBuilder.buildBodyGetRevisionsInstance(bodyBuilder, parameterNames); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName, revisonItemListType, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata }
From source file:org.gvnix.addon.geo.addon.GvNIXGeoConversionServiceMetadata.java
/** * Gets <code>getStringToGeometryConverter</code> method. <br> * /*from www . j a va2 s . c o m*/ * @return */ private MethodMetadata getStringToGeometryConverterMethod() { // Define method parameter types List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>(); // Check if a method with the same signature already exists in the // target type final MethodMetadata method = methodExists(STRING_TO_GEOMETRY_METHOD, 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>(); // Define method throws types List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>(); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); buildGetStringToGeometryConverterMethodBody(bodyBuilder); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, STRING_TO_GEOMETRY_METHOD, CONVERTER_STRING_GEOMETRY, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata // instance }
From source file:org.gvnix.addon.jpa.addon.audit.JpaAuditMetadata.java
/** * @return gets or creates getXXXRevisions(id, fromData,toDate,start,limit) * method/* w w w .jav a2 s. co m*/ */ private MethodMetadata getGetRevisionsMethod() { // method name JavaSymbolName methodName = getRevisionsMethodName; // Define method parameter types List<AnnotatedJavaType> parameterTypes = helper.toAnnotedJavaType(identifier.getFieldType(), JdkJavaType.DATE, JdkJavaType.DATE, JavaType.INT_OBJECT, JavaType.INT_OBJECT); // Check if a method exist in type final MethodMetadata method = helper.methodExists(methodName, parameterTypes); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names (none in this case) List<JavaSymbolName> parameterNames = helper.toSymbolName(identifier.getFieldName().getSymbolName(), "fromDate", "toDate", "start", "limit"); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); revisionLogBuilder.buildBodyGetRevisions(bodyBuilder, parameterNames); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC + Modifier.STATIC, methodName, revisonItemListType, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata }
From source file:org.gvnix.addon.geo.addon.GvNIXGeoConversionServiceMetadata.java
/** * Gets <code>getMultiLineStringToStringConverter</code> method. <br> * //from ww w . jav a 2s. c om * @return */ private MethodMetadata getMultiLineStringToStringConverterMethod() { // Define method parameter types List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>(); // Check if a method with the same signature already exists in the // target type final MethodMetadata method = methodExists(MULTLINESTR_TO_STR_MET, 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>(); // Define method throws types List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>(); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); buildGetMultiLineStringToStringConverterMethodBody(bodyBuilder); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, MULTLINESTR_TO_STR_MET, CONV_MULTSTR_STR, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata // instance }
From source file:org.gvnix.addon.jpa.addon.batch.JpaBatchMetadata.java
/** * Return method to delete entity based on a list of pks of the entity * /* w w w. j a va2 s. c o m*/ * @param methodName for generated method * @param condition use IN or NOT IN delete-by-list operation * @return */ private MethodMetadata getDeleteByIdsListMethod(JavaSymbolName methodName, String condition) { // Define parameters types List<AnnotatedJavaType> parameterTypes = AnnotatedJavaType.convertFromJavaTypes(listOfIdentifiersType); // Check if a method exist in type final MethodMetadata method = methodExists(methodName, parameterTypes); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); annotations.add(new AnnotationMetadataBuilder(SpringJavaType.TRANSACTIONAL)); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names (none in this case) JavaSymbolName parameterName = new JavaSymbolName("ids"); List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>(); parameterNames.add(parameterName); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); buildDeleteByIdListMethod(condition, parameterName, bodyBuilder); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC, methodName, JavaType.INT_PRIMITIVE, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata // instance }
From source file:org.gvnix.addon.jpa.addon.audit.JpaAuditMetadata.java
/** * @return gets or creates findXXX(id, revision) method *///from ww w.j a v a 2 s.c o m private MethodMetadata getFindFromRevisionMethod() { // method name JavaSymbolName methodName = findMethodName; // Define method parameter types List<AnnotatedJavaType> parameterTypes = helper.toAnnotedJavaType(identifier.getFieldType(), JavaType.LONG_PRIMITIVE); // Check if a method exist in type final MethodMetadata method = helper.methodExists(methodName, parameterTypes); if (method != null) { // If it already exists, just return the method return method; } // Define method annotations (none in this case) List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); // Define method throws types (none in this case) List<JavaType> throwsTypes = new ArrayList<JavaType>(); // Define method parameter names (none in this case) List<JavaSymbolName> parameterNames = helper.toSymbolName(identifier.getFieldName().getSymbolName(), "revision"); // Create the method body InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder(); revisionLogBuilder.buildBodyFindFromRevision(bodyBuilder, parameterNames); // Use the MethodMetadataBuilder for easy creation of MethodMetadata MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC + Modifier.STATIC, methodName, entity, parameterTypes, parameterNames, bodyBuilder); methodBuilder.setAnnotations(annotations); methodBuilder.setThrowsTypes(throwsTypes); return methodBuilder.build(); // Build and return a MethodMetadata }