public static UploadedFileContentType getFileExtension(final String contentType) { for (UploadedFileContentType uploadedFileContentType : UploadedFileContentType.values()) { if (uploadedFileContentType.getContentType().equals(contentType)) { return uploadedFileContentType; } } throw new IllegalStateException("Unknown content type '" + contentType + "'"); }
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add( new StringAttributeValue(new JavaSymbolName("contentType"), contentType.getContentType())); if (autoUpload) { attrs.add(new BooleanAttributeValue(new JavaSymbolName("autoUpload"), autoUpload)); } annotations.add(new AnnotationMetadataBuilder(ROO_UPLOADED_FILE, attrs)); annotations.add(new AnnotationMetadataBuilder(LOB)); }