@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>(); if (enumType != null) { JavaSymbolName value = new JavaSymbolName("ORDINAL"); if (enumType == EnumType.STRING) { value = new JavaSymbolName("STRING"); } attributes.add(new EnumAttributeValue(new JavaSymbolName("value"), new EnumDetails(ENUM_TYPE, value))); } annotations.add(new AnnotationMetadataBuilder(ENUMERATED, attributes)); }
public void addEnumAttribute(final String key, final JavaType javaType, final JavaSymbolName enumConstant) { final EnumDetails details = new EnumDetails(javaType, enumConstant); addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details)); }
private void setDateAnnotations(final String columnDefinition, final List<AnnotationMetadataBuilder> annotations) { // Add JSR 220 @Temporal annotation to date fields String temporalType = StringUtils.defaultIfEmpty(StringUtils.upperCase(columnDefinition), "DATE"); if ("DATETIME".equals(temporalType)) { 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-"); annotations.add(dateTimeFormatBuilder); } }
/** * This method provides @RooWsClient annotation with all the necessary attributes * * @param endpoint * @param targetNamespace * @param bindingType * @return */ private AnnotationMetadataBuilder getWsClientAnnotation(final String endpoint, final String targetNamespace, final SoapBindingType bindingType) { final List<AnnotationAttributeValue<?>> wsClientAttributes = new ArrayList<AnnotationAttributeValue<?>>(); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("endpoint"), endpoint)); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("targetNamespace"), targetNamespace)); wsClientAttributes.add(new EnumAttributeValue(new JavaSymbolName("binding"), new EnumDetails( RooJavaType.ROO_ENUM_SOAP_BINDING_TYPE, new JavaSymbolName(bindingType.name())))); return new AnnotationMetadataBuilder(RooJavaType.ROO_WS_CLIENT, wsClientAttributes); }
/** * Method that returns @RooController annotation * * @param entity * Entity over which create the controller * @param pathPrefix * Prefix to use in RequestMapping * @param controllerType * Indicates the controller type * @return */ private AnnotationMetadataBuilder getRooControllerAnnotation(final JavaType entity, final String pathPrefix, final ControllerType controllerType) { final List<AnnotationAttributeValue<?>> rooControllerAttributes = new ArrayList<AnnotationAttributeValue<?>>(); rooControllerAttributes.add(new ClassAttributeValue(new JavaSymbolName(ENTITY_KEY), entity)); if (StringUtils.isNotEmpty(pathPrefix)) { rooControllerAttributes.add(new StringAttributeValue(new JavaSymbolName("pathPrefix"), pathPrefix)); } rooControllerAttributes.add(new EnumAttributeValue(new JavaSymbolName("type"), new EnumDetails( RooJavaType.ROO_ENUM_CONTROLLER_TYPE, new JavaSymbolName(controllerType.name())))); return new AnnotationMetadataBuilder(RooJavaType.ROO_CONTROLLER, rooControllerAttributes); }
attrs.add(new EnumAttributeValue(new JavaSymbolName("value"), new EnumDetails(TEMPORAL_TYPE, new JavaSymbolName(value)))); annotations.add(new AnnotationMetadataBuilder(TEMPORAL, attrs));
for (Cascade type : cascadeType) { cascadeValues.add(new EnumAttributeValue(new JavaSymbolName("cascade"), new EnumDetails(CASCADE_TYPE, new JavaSymbolName(type.name())))); value = new JavaSymbolName("LAZY"); attributes.add(new EnumAttributeValue(new JavaSymbolName("fetch"), new EnumDetails( FETCH_TYPE, value)));
public void addEnumAttribute(final String key, final JavaType javaType, final String enumConstant) { final EnumDetails details = new EnumDetails(javaType, new JavaSymbolName(enumConstant)); addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details)); }
List<EnumAttributeValue> cascadeValues = new ArrayList<EnumAttributeValue>(); for (Cascade type : cascadeType) { cascadeValues.add(new EnumAttributeValue(new JavaSymbolName("cascade"), new EnumDetails( CASCADE_TYPE, new JavaSymbolName(type.name())))); value = new JavaSymbolName("LAZY"); attributes.add(new EnumAttributeValue(new JavaSymbolName("fetch"), new EnumDetails( FETCH_TYPE, value)));
/** * Returns the JPA @Inheritance annotation to be applied to the entity, if * applicable * * @param annotationValues the values of the {@link RooJpaEntity} annotation * (required) * @return <code>null</code> if it's already present or not required */ private AnnotationMetadata getInheritanceAnnotation() { if (governorTypeDetails.getAnnotation(INHERITANCE) != null) { return null; } if (StringUtils.isNotBlank(annotationValues.getInheritanceType())) { final AnnotationMetadataBuilder inheritanceBuilder = new AnnotationMetadataBuilder(INHERITANCE); inheritanceBuilder.addEnumAttribute("strategy", new EnumDetails(INHERITANCE_TYPE, new JavaSymbolName(annotationValues.getInheritanceType()))); return inheritanceBuilder.build(); } return null; }
temporalAnnotation.addEnumAttribute("value", new EnumDetails(JpaJavaType.TEMPORAL_TYPE, new JavaSymbolName("TIMESTAMP"))); annotations.add(temporalAnnotation);
temporalAnnotation.addEnumAttribute("value", new EnumDetails(JpaJavaType.TEMPORAL_TYPE, new JavaSymbolName("TIMESTAMP"))); annotations.add(temporalAnnotation);
public void addEnumAttribute(final String key, final String fullyQualifiedTypeName, final String enumConstant) { final EnumDetails details = new EnumDetails(new JavaType(fullyQualifiedTypeName), new JavaSymbolName(enumConstant)); addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details)); }
JavaParserUtils.getJavaType(compilationUnitServices, nameToFind, null); final EnumDetails enumDetails = new EnumDetails(fieldType, new JavaSymbolName(fieldName)); return new EnumAttributeValue(annotationName, enumDetails); final EnumDetails enumDetails = new EnumDetails(fieldType, new JavaSymbolName(name)); return new EnumAttributeValue(annotationName, enumDetails);
generatedValueBuilder.addEnumAttribute("strategy", new EnumDetails(GENERATION_TYPE, new JavaSymbolName(identifierStrategy.name())));
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType( "javax.persistence.FetchType"), new JavaSymbolName("LAZY"))); fieldDetails.getInitedAnnotations().add(basicAnnotation);
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType( "javax.persistence.FetchType"), new JavaSymbolName("LAZY"))); fieldDetails.getInitedAnnotations().add(basicAnnotation);
basicAnnotation.addEnumAttribute("fetch", new EnumDetails(new JavaType( "javax.persistence.FetchType"), new JavaSymbolName("LAZY"))); fieldDetails.getInitedAnnotations().add(basicAnnotation);
controllerAnnotation.addStringAttribute("pathPrefix", pathPrefix); controllerAnnotation.addEnumAttribute("type", new EnumDetails( RooJavaType.ROO_ENUM_CONTROLLER_TYPE, new JavaSymbolName("SEARCH"))); controllerBuilder.addAnnotation(controllerAnnotation.build());
public void addEnumAttribute(final String key, final JavaType javaType, final String enumConstant) { final EnumDetails details = new EnumDetails(javaType, new JavaSymbolName(enumConstant)); addAttribute(new EnumAttributeValue(new JavaSymbolName(key), details)); }