BeanComparator<?> subOrder = forClass(prop.getType()); subOrder.mCollator = mCollator; bc = bc.using(subOrder.orderBy(subName));
IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
public final Class<?> getType() { return mBeanProperty.getType(); }
public final Class<?> getType() { return mBeanProperty.getType(); }
if (bp.getType().isPrimitive()) { continue; boolean primitive = bp.getType().isPrimitive(); if (pass == 1 && primitive) { continue; b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT); b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params);
/** * @return null if unknown */ private static Class propertyType(Class enclosingType, String propertyName) { Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(enclosingType); int dotIndex = propertyName.indexOf('.'); if (dotIndex < 0) { BeanProperty bp = properties.get(propertyName); return bp == null ? null : bp.getType(); } else { String parentName = propertyName.substring(0, dotIndex); BeanProperty bp = properties.get(parentName); if (bp == null) { return null; } return propertyType(bp.getType(), propertyName.substring(dotIndex + 1)); } }
/** * @return null if unknown */ private static Class propertyType(Class enclosingType, String propertyName) { Map<String, BeanProperty> properties = BeanIntrospector.getAllProperties(enclosingType); int dotIndex = propertyName.indexOf('.'); if (dotIndex < 0) { BeanProperty bp = properties.get(propertyName); return bp == null ? null : bp.getType(); } else { String parentName = propertyName.substring(0, dotIndex); BeanProperty bp = properties.get(parentName); if (bp == null) { return null; } return propertyType(bp.getType(), propertyName.substring(dotIndex + 1)); } }
b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); TypeDesc type = TypeDesc.forClass(bp.getType()); b.convert(type, type.toObjectType()); b.returnValue(TypeDesc.OBJECT); b.loadLocal(beanVar); b.loadLocal(valueVar); TypeDesc type = TypeDesc.forClass(bp.getType()); b.checkCast(type.toObjectType()); b.convert(type.toObjectType(), type);
/** * @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; }
/** * @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; }
SimpleProperty(BeanProperty property, Class<S> enclosing, boolean nullable, boolean primaryKey, boolean alternateKey, boolean partitionKey, String[] aliases, StorablePropertyConstraint[] constraints, StorablePropertyAdapter adapter, boolean isVersion, String sequence, boolean independent, boolean automatic, Derived derived, String name) { mBeanProperty = property; mEnclosingType = enclosing; mNullable = property.getType().isPrimitive() ? false : nullable; mPrimaryKey = primaryKey; mAlternateKey = alternateKey; mPartitionKey = partitionKey; mAliases = aliases; mConstraints = constraints; mAdapter = adapter; mIsVersion = isVersion; mSequence = sequence; mIndependent = independent; mAutomatic = automatic; mIsDerived = derived != null; mShouldCopyDerived = (mIsDerived ? derived.shouldCopy() : false); mDerived = derived; mBeanName = mBeanProperty.getName(); mName = name == null ? mBeanName : name; }
SimpleProperty(BeanProperty property, Class<S> enclosing, boolean nullable, boolean primaryKey, boolean alternateKey, boolean partitionKey, String[] aliases, StorablePropertyConstraint[] constraints, StorablePropertyAdapter adapter, boolean isVersion, String sequence, boolean independent, boolean automatic, Derived derived, String name) { mBeanProperty = property; mEnclosingType = enclosing; mNullable = property.getType().isPrimitive() ? false : nullable; mPrimaryKey = primaryKey; mAlternateKey = alternateKey; mPartitionKey = partitionKey; mAliases = aliases; mConstraints = constraints; mAdapter = adapter; mIsVersion = isVersion; mSequence = sequence; mIndependent = independent; mAutomatic = automatic; mIsDerived = derived != null; mShouldCopyDerived = (mIsDerived ? derived.shouldCopy() : false); mDerived = derived; mBeanName = mBeanProperty.getName(); mName = name == null ? mBeanName : name; }
/** * Used with automatic adapter selection. * * @see AutomaticAdapterSeletor */ StorablePropertyAdapter(BeanProperty property, StorablePropertyAnnotation annotation) { this(getEnclosingType(property), property.getName(), property.getType(), annotation, annotation.getAnnotationType()); }
/** * Used with automatic adapter selection. * * @see AutomaticAdapterSeletor */ StorablePropertyAdapter(BeanProperty property, StorablePropertyAnnotation annotation) { this(getEnclosingType(property), property.getName(), property.getType(), annotation, annotation.getAnnotationType()); }
Class propertyClass = prop.getType(); TypeDesc propertyType = TypeDesc.forClass(propertyClass);
BeanComparator<?> subOrder = forClass(prop.getType()); subOrder.mCollator = mCollator; bc = bc.using(subOrder.orderBy(subName));
IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
if (bp.getType().isPrimitive()) { continue; boolean primitive = bp.getType().isPrimitive(); if (pass == 1 && primitive) { continue; b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT); b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params);