Package com.thoughtworks.xstream.converters.javabean

Examples of com.thoughtworks.xstream.converters.javabean.BeanProperty


   * @param definedIn
   * @return
   */
  public BeanProperty property(Class<?> cls, String name) {
    Map<String, BeanProperty> properties = buildMap(cls);
    BeanProperty property = (BeanProperty) properties.get(name);
    if (property == null) {
      throw new ObjectAccessException("No such property " + cls.getName() + "."
          + name);
    } else {
      return property;
View Full Code Here


                propertyName = Introspector.decapitalize(methodName
                    .substring(3));
              else
                propertyName = Introspector.decapitalize(methodName
                    .substring(2));
              BeanProperty property = getBeanProperty(propertyMap, cls,
                  propertyName, returnType);
              property.setGetterMethod(methods[i]);
            } else if (methodName.startsWith("set") && parameters.length == 1
                && returnType.equals(void.class)) {
              propertyName = Introspector.decapitalize(methodName.substring(3));
              BeanProperty property = getBeanProperty(propertyMap, cls,
                  propertyName, parameters[0]);
              property.setSetterMethod(methods[i]);
            }
          }

          // retain only those that can be both read and written and
          // sort them by name
          List<BeanProperty> serializableProperties = Lists.newArrayList();
          for (BeanProperty property : propertyMap.values()) {
            if (property.isReadable() || property.isWritable()) {
              serializableProperties.add(property);
            }
          }
          Collections
              .sort(serializableProperties, new BeanPropertyComparator());

          // build the maps and return
          final Map<String, BeanProperty> keyedByFieldName = new OrderRetainingMap();
          for (BeanProperty property : serializableProperties) {
            keyedByFieldName.put(property.getName(), property);
          }

          keyedByPropertyNameCache.put(clsName, keyedByFieldName);
        }
      }
View Full Code Here

  private BeanProperty getBeanProperty(
      Map<PropertyKey, BeanProperty> propertyMap, Class<?> cls,
      String propertyName, Class<?> type) {
    PropertyKey key = new PropertyKey(propertyName, type);
    BeanProperty property = (BeanProperty) propertyMap.get(key);
    if (property == null) {
      property = new BeanProperty(cls, propertyName, type);
      propertyMap.put(key, property);
    }
    return property;
  }
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.converters.javabean.BeanProperty

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.