# HG changeset patch # Parent 982acbc28cc84e6734aaf4b495d8be8c78fc26dd diff --git a/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java b/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java --- a/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java +++ b/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java @@ -15,12 +15,7 @@ */ package org.yaml.snakeyaml.introspector; -import java.beans.FeatureDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.HashMap; @@ -64,9 +59,6 @@ } Map properties = new LinkedHashMap(); - boolean inaccessableFieldsExist = false; - switch (bAccess) { - case FIELD: for (Class c = type; c != null; c = c.getSuperclass()) { for (Field field : c.getDeclaredFields()) { int modifiers = field.getModifiers(); @@ -76,50 +68,10 @@ } } } - break; - default: - // add JavaBean properties - try { - for (PropertyDescriptor property : Introspector.getBeanInfo(type) - .getPropertyDescriptors()) { - Method readMethod = property.getReadMethod(); - if ((readMethod == null || !readMethod.getName().equals("getClass")) - && !isTransient(property)) { - properties.put(property.getName(), new MethodProperty(property)); - } - } - } catch (IntrospectionException e) { - throw new YAMLException(e); - } - - // add public fields - for (Class c = type; c != null; c = c.getSuperclass()) { - for (Field field : c.getDeclaredFields()) { - int modifiers = field.getModifiers(); - if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { - if (Modifier.isPublic(modifiers)) { - properties.put(field.getName(), new FieldProperty(field)); - } else { - inaccessableFieldsExist = true; - } - } - } - } - break; - } - if (properties.isEmpty() && inaccessableFieldsExist) { - throw new YAMLException("No JavaBean properties found in " + type.getName()); - } propertiesCache.put(type, properties); return properties; } - private static final String TRANSIENT = "transient"; - - private boolean isTransient(FeatureDescriptor fd) { - return Boolean.TRUE.equals(fd.getValue(TRANSIENT)); - } - public Set getProperties(Class type) { return getProperties(type, beanAccess); }