private boolean acceptIdProperty(BeanProperty property) { return property.isReadable() && property.getReadMethod().hasAnnotation(Id.class); }
public TypeContext(BeanProperty beanProperty) { this(beanProperty.getReadMethod(), beanProperty.getType()); }
public Map<String, BeanProperty> getProperties() { try { ImmutableMap.Builder<String, BeanProperty> properties = ImmutableMap.builder(); BeanInfo beanInfo = Introspector.getBeanInfo(getRawType(), Object.class); for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) { MethodDescriptor readMethod = getMethodDescriptor(propertyDescriptor.getReadMethod()); MethodDescriptor writeMethod = getMethodDescriptor(propertyDescriptor.getWriteMethod()); if (readMethod != null || writeMethod != null) { BeanProperty property = new BeanProperty(propertyDescriptor.getName(), readMethod, writeMethod); properties.put(property.getName(), property); } } return properties.build(); } catch (Exception e) { throw new ReflectionException(toString(), e); } }
private void add(BeanProperty property) { if (acceptIdProperty(property)) { String name = getName(property.getReadMethod(), property.getName()); setIdentifier(name, property, new TypeContext(property)); } else if (acceptProperty(property)) { String name = getName(property.getReadMethod(), property.getName()); add(name, property, new TypeContext(property)); } }
private boolean acceptProperty(BeanProperty property) { return property.isReadable() && property.getReadMethod().hasAnnotation(VersionProperty.class); }