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; }
IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
/** * 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 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); }
b.loadConstant(bp.getName()); b.loadLocal(propertyVar); b.invokeVirtual(String.class.getName(), "equals", TypeDesc.BOOLEAN, params);
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 by StorableIntrospector. * * @see StorableIntrospector */ StorablePropertyAdapter(BeanProperty property, StorablePropertyAnnotation annotation, AdapterDefinition ad, Constructor ctor, Method[] adaptMethods) { mEnclosingType = getEnclosingType(property); mPropertyName = property.getName(); mAnnotation = annotation; mConstructor = ctor; mAdaptMethods = adaptMethods; Class[] storageTypePreferences = ad.storageTypePreferences(); if (storageTypePreferences != null && storageTypePreferences.length == 0) { storageTypePreferences = null; } mStorageTypePreferences = storageTypePreferences; }
/** * Used by StorableIntrospector. * * @see StorableIntrospector */ StorablePropertyAdapter(BeanProperty property, StorablePropertyAnnotation annotation, AdapterDefinition ad, Constructor ctor, Method[] adaptMethods) { mEnclosingType = getEnclosingType(property); mPropertyName = property.getName(); mAnnotation = annotation; mConstructor = ctor; mAdaptMethods = adaptMethods; Class[] storageTypePreferences = ad.storageTypePreferences(); if (storageTypePreferences != null && storageTypePreferences.length == 0) { storageTypePreferences = null; } mStorageTypePreferences = storageTypePreferences; }
/** * 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()); }
IndexedProperty(BeanProperty property) { super(property.getName(), property.getType(), property.getCovariantTypes()); setReadMethod(property.getReadMethod()); setWriteMethod(property.getWriteMethod()); }
b.loadConstant(bp.getName()); b.loadLocal(propertyVar); b.invokeVirtual(String.class.getName(), "equals", TypeDesc.BOOLEAN, params);