Skip to content

Commit

Permalink
ROO-516: JSF 2.0 Addon - file upload fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Stewart committed Oct 10, 2011
1 parent 6105ffe commit b688427
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 184 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.springframework.roo.addon.displaystring;

import static org.springframework.roo.model.JavaType.STRING;
import static org.springframework.roo.model.JdkJavaType.ARRAYS;
import static org.springframework.roo.model.JdkJavaType.CALENDAR;
import static org.springframework.roo.model.JdkJavaType.DATE;
import static org.springframework.roo.model.JdkJavaType.DATE_FORMAT;
Expand Down Expand Up @@ -93,11 +92,8 @@ private MethodMetadata getDisplayStringMethod() {
for (MethodMetadata accessor : locatedAccessors) {
String accessorName = accessor.getMethodName().getSymbolName();
String accessorText;
if (accessor.getReturnType().isCommonCollectionType()) {
if (accessor.getReturnType().isCommonCollectionType() || accessor.getReturnType().isArray()) {
continue;
} else if (accessor.getReturnType().isArray()) {
imports.addImport(ARRAYS);
accessorText = "Arrays.toString(" + accessorName + "())";
} else if (CALENDAR.equals(accessor.getReturnType())) {
imports.addImport(DATE_FORMAT);
accessorText = accessorName + "() == null ? \"\" : DateFormat.getDateInstance(DateFormat.LONG).format(" + accessorName + "().getTime())";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import static org.springframework.roo.model.RooJavaType.ROO_DISPLAY_STRING;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
Expand Down Expand Up @@ -71,11 +68,7 @@ protected String getLocalMidToRequest(final ItdTypeDetails itdTypeDetails) {
}

private List<MethodMetadata> locateAccessors(final JavaType entity, final MemberDetails memberDetails, final String metadataIdentificationString) {
final SortedSet<MethodMetadata> locatedAccessors = new TreeSet<MethodMetadata>(new Comparator<MethodMetadata>() {
public int compare(final MethodMetadata l, final MethodMetadata r) {
return l.getMethodName().compareTo(r.getMethodName());
}
});
List<MethodMetadata> locatedAccessors = new ArrayList<MethodMetadata>();

for (final MethodMetadata method : memberDetails.getMethods()) {
if (!BeanInfoUtils.isAccessorMethod(method)) {
Expand All @@ -93,7 +86,7 @@ public int compare(final MethodMetadata l, final MethodMetadata r) {
locatedAccessors.add(method);
}

return new ArrayList<MethodMetadata>(locatedAccessors);
return locatedAccessors;
}

private boolean isApplicationType(final JavaType javaType) {
Expand Down
Loading

0 comments on commit b688427

Please sign in to comment.