IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
public Standard(BeanPropertyAccessor<B> accessor, Map<String, BeanProperty> properties) { mAccessor = accessor; // Only reveal readable properties. SortedSet<String> propertyNames = new TreeSet<String>(); for (BeanProperty property : properties.values()) { if (property.getReadMethod() != null) { propertyNames.add(property.getName()); } } mPropertyNames = Collections.unmodifiableSortedSet(propertyNames); }
set == PropertySet.READ_WRITE_UNCHECKED_EXCEPTIONS) if (bp.getReadMethod() == null || bp.getWriteMethod() == null) { continue; set != PropertySet.READ_WRITE_UNCHECKED_EXCEPTIONS; if (bp.getReadMethod() != null) { if (checkedAllowed || !throwsCheckedException(bp.getReadMethod())) { readProperties.add(bp); if (bp.getWriteMethod() != null) { if (checkedAllowed || !throwsCheckedException(bp.getWriteMethod())) { writeProperties.add(bp);
if (prop.getReadMethod() == null) { throw new IllegalArgumentException ("Property '" + propertyName + "' cannot be read"); BeanComparator<?> subOrder = forClass(prop.getType()); subOrder.mCollator = mCollator; bc = bc.using(subOrder.orderBy(subName));
public final Class<?> getType() { return mBeanProperty.getType(); }
/** * Returns an array of Lists of BeanProperties. The first index * matches a switch case, the second index provides a list of all the * BeanProperties whose name hash matched on the case. */ private static List[] caseMethods(int caseCount, BeanProperty[] props) { List[] cases = new List[caseCount]; for (int i=0; i<props.length; i++) { BeanProperty prop = props[i]; int hashCode = prop.getName().hashCode(); int caseValue = (hashCode & 0x7fffffff) % caseCount; List matches = cases[caseValue]; if (matches == null) { matches = cases[caseValue] = new ArrayList(); } matches.add(prop); } return cases; }
public final Method getWriteMethod() { return mBeanProperty.getWriteMethod(); }
public final Method getReadMethod() { return mBeanProperty.getReadMethod(); }
if (property.getReadMethod() == null || property.getWriteMethod() == null || BeanPropertyAccessor.throwsCheckedException(property.getReadMethod()) || BeanPropertyAccessor.throwsCheckedException(property.getWriteMethod()))
if (bp.getType().isPrimitive()) { continue; b.invoke(bp.getReadMethod()); boolean primitive = bp.getType().isPrimitive(); if (pass == 1 && primitive) { continue; b.invoke(bp.getReadMethod()); b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT); b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params);
public final Class<?> getType() { return mBeanProperty.getType(); }
public Standard(BeanPropertyAccessor<B> accessor, Map<String, BeanProperty> properties) { mAccessor = accessor; // Only reveal readable properties. SortedSet<String> propertyNames = new TreeSet<String>(); for (BeanProperty property : properties.values()) { if (property.getReadMethod() != null) { propertyNames.add(property.getName()); } } mPropertyNames = Collections.unmodifiableSortedSet(propertyNames); }
/** * Returns an array of Lists of BeanProperties. The first index * matches a switch case, the second index provides a list of all the * BeanProperties whose name hash matched on the case. */ private static List[] caseMethods(int caseCount, BeanProperty[] props) { List[] cases = new List[caseCount]; for (int i=0; i<props.length; i++) { BeanProperty prop = props[i]; int hashCode = prop.getName().hashCode(); int caseValue = (hashCode & 0x7fffffff) % caseCount; List matches = cases[caseValue]; if (matches == null) { matches = cases[caseValue] = new ArrayList(); } matches.add(prop); } return cases; }
public final Method getWriteMethod() { return mBeanProperty.getWriteMethod(); }
public final Method getReadMethod() { return mBeanProperty.getReadMethod(); }
IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
static Class getEnclosingType(BeanProperty property) { Method m = property.getReadMethod(); if (m == null) { m = property.getWriteMethod(); } return m.getDeclaringClass(); }
/** * @param property bean property which must have a read method * @return adapter with a null annotation, or null if nothing applicable */ static StorablePropertyAdapter selectAdapterFor(final BeanProperty property) { final Method readMethod = property.getReadMethod(); if (readMethod == null) { throw new IllegalArgumentException(); } final Class propertyType = property.getType(); if (DateTime.class.isAssignableFrom(propertyType) || DateMidnight.class.isAssignableFrom(propertyType) || LocalDate.class.isAssignableFrom(propertyType) || LocalDateTime.class.isAssignableFrom(propertyType) || java.util.Date.class.isAssignableFrom(propertyType)) { return selectAdapter(property, DateTimeAdapter.class, readMethod); } else if (String.class.isAssignableFrom(propertyType)) { return selectAdapter(property, TextAdapter.class, readMethod); } // else if ... return null; }