javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java
branchmodel
changeset 769 0c0fe97fe0c7
parent 768 e320d8156140
child 770 26513bd377b9
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java	Tue Feb 19 16:16:22 2013 +0100
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java	Wed Feb 20 18:14:59 2013 +0100
     1.3 @@ -501,30 +501,46 @@
     1.4              ret = tm.toString();
     1.5          }
     1.6          if (p.array()) {
     1.7 -            if (ret.equals("byte")) {
     1.8 -                return Byte.class.getName();
     1.9 -            }
    1.10 -            if (ret.equals("short")) {
    1.11 -                return Short.class.getName();
    1.12 -            }
    1.13 -            if (ret.equals("char")) {
    1.14 -                return Character.class.getName();
    1.15 -            }
    1.16 -            if (ret.equals("int")) {
    1.17 -                return Integer.class.getName();
    1.18 -            }
    1.19 -            if (ret.equals("long")) {
    1.20 -                return Long.class.getName();
    1.21 -            }
    1.22 -            if (ret.equals("float")) {
    1.23 -                return Float.class.getName();
    1.24 -            }
    1.25 -            if (ret.equals("double")) {
    1.26 -                return Double.class.getName();
    1.27 +            String bt = findBoxedType(ret);
    1.28 +            if (bt != null) {
    1.29 +                return bt;
    1.30              }
    1.31          }
    1.32 +        if ("java.lang.String".equals(ret)) {
    1.33 +            return ret;
    1.34 +        }
    1.35 +        String bt = findBoxedType(ret);
    1.36 +        if (bt != null) {
    1.37 +            return ret;
    1.38 +        }
    1.39 +        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Only primitive types supported in the mapping. Not " + ret);
    1.40          return ret;
    1.41      }
    1.42 +    
    1.43 +    private static String findBoxedType(String ret) {
    1.44 +        if (ret.equals("byte")) {
    1.45 +            return Byte.class.getName();
    1.46 +        }
    1.47 +        if (ret.equals("short")) {
    1.48 +            return Short.class.getName();
    1.49 +        }
    1.50 +        if (ret.equals("char")) {
    1.51 +            return Character.class.getName();
    1.52 +        }
    1.53 +        if (ret.equals("int")) {
    1.54 +            return Integer.class.getName();
    1.55 +        }
    1.56 +        if (ret.equals("long")) {
    1.57 +            return Long.class.getName();
    1.58 +        }
    1.59 +        if (ret.equals("float")) {
    1.60 +            return Float.class.getName();
    1.61 +        }
    1.62 +        if (ret.equals("double")) {
    1.63 +            return Double.class.getName();
    1.64 +        }
    1.65 +        return null;
    1.66 +    }
    1.67  
    1.68      private boolean verifyPropName(Element e, String propName, Property[] existingProps) {
    1.69          StringBuilder sb = new StringBuilder();