/** * @return null if no change */ SimpleProperty addCovariantType(Class type) { if (mType == type) { return null; } for (Class covariant : mCovariantTypes) { if (covariant == type) { return null; } } // Find most specialized type. Class newType = mType; if (mType.isAssignableFrom(type)) { newType = type; } for (Class covariant : mCovariantTypes) { if (covariant.isAssignableFrom(type)) { newType = type; } } Class[] newCovariant = new Class[1 + mCovariantTypes.length]; System.arraycopy(mCovariantTypes, 0, newCovariant, 1, mCovariantTypes.length); newCovariant[0] = newType == mType ? type : mType; SimpleProperty property = new SimpleProperty(mName, newType, newCovariant); property.mReadMethod = mReadMethod; property.mWriteMethod = mWriteMethod; return property; }
property = new SimpleProperty(name, type); properties.put(name, property); property = new SimpleProperty(name, type); properties.put(name, property); property = new SimpleProperty(name, type); properties.put(name, property);
/** * @return null if no change */ SimpleProperty addCovariantType(Class type) { if (mType == type) { return null; } for (Class covariant : mCovariantTypes) { if (covariant == type) { return null; } } // Find most specialized type. Class newType = mType; if (mType.isAssignableFrom(type)) { newType = type; } for (Class covariant : mCovariantTypes) { if (covariant.isAssignableFrom(type)) { newType = type; } } Class[] newCovariant = new Class[1 + mCovariantTypes.length]; System.arraycopy(mCovariantTypes, 0, newCovariant, 1, mCovariantTypes.length); newCovariant[0] = newType == mType ? type : mType; SimpleProperty property = new SimpleProperty(mName, newType, newCovariant); property.mReadMethod = mReadMethod; property.mWriteMethod = mWriteMethod; return property; }
property = new SimpleProperty(name, type); properties.put(name, property); property = new SimpleProperty(name, type); properties.put(name, property); property = new SimpleProperty(name, type); properties.put(name, property);