Package org.geomajas.global

Examples of org.geomajas.global.Json


    bd.writableProps = new HashMap<String, Method>();
    PropertyDescriptor[] props = bd.beanInfo.getPropertyDescriptors();
    for (PropertyDescriptor prop : props) {
      Method writeMethod = prop.getWriteMethod();
      if (writeMethod != null) {
        Json json = writeMethod.getAnnotation(Json.class);
        if (json == null || json.serialize()) {
          bd.writableProps.put(prop.getName(), writeMethod);
        } else {
          log.debug("skipping property {} for {}", prop.getName(), clazz.getName());
        }
      }
      Method readMethod = prop.getReadMethod();
      // due to a bug in the JAXB spec, Boolean getters are using isXXX
      // i.o. getXXX as
      // expected by bean introspectors
      if (readMethod == null) {
        if (writeMethod != null && writeMethod.getParameterTypes()[0].equals(Boolean.class)) {
          if (writeMethod.getName().startsWith("set")) {
            String isMethodName = "is" + writeMethod.getName().substring(3);
            try {
              readMethod = clazz.getMethod(isMethodName);
              if (!readMethod.getReturnType().equals(Boolean.class)) {
                readMethod = null;
              }
            } catch (Exception e) {
              log.error("discarding:" + e.getMessage());
            }
          }
        }
      }
      if (readMethod != null) {
        Json json = readMethod.getAnnotation(Json.class);
        if (json == null || json.serialize()) {
          bd.readableProps.put(prop.getName(), readMethod);
        }
      }
    }
    if (clazz.isEnum()) {
View Full Code Here

TOP

Related Classes of org.geomajas.global.Json

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.