/** * Specialized method that can be used to replace an existing entry * (note: entry MUST exist; otherwise exception is thrown) with * specified replacement. * * @since 2.9.4 */ public void replace(SettableBeanProperty origProp, SettableBeanProperty newProp) { int i = 1; int end = _hashArea.length; for (;; i += 2) { if (i > end) { throw new NoSuchElementException("No entry '"+origProp.getName()+"' found, can't replace"); } if (_hashArea[i] == origProp) { _hashArea[i] = newProp; break; } } _propsInOrder[_findFromOrdered(origProp)] = newProp; }
@Deprecated // in 2.9.4 -- must call method that takes old and new property to avoid mismatch public void replace(SettableBeanProperty newProp) { String key = getPropertyName(newProp); int ix = _findIndexInHash(key); if (ix < 0) { throw new NoSuchElementException("No entry '"+key+"' found, can't replace"); } SettableBeanProperty prop = (SettableBeanProperty) _hashArea[ix]; _hashArea[ix] = newProp; // also, replace in in-order _propsInOrder[_findFromOrdered(prop)] = newProp; }
if (found) { _propsInOrder[_findFromOrdered(prop)] = null; continue;
/** * Fluent copy method that creates a new instance that is a copy * of this instance except for one additional property that is * passed as the argument. * Note that method does not modify this instance but constructs * and returns a new one. */ public BeanPropertyMap withProperty(SettableBeanProperty newProp) { // First: may be able to just replace? String key = getPropertyName(newProp); for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if ((prop != null) && prop.getName().equals(key)) { return new BeanPropertyMap(this, newProp, i, _findFromOrdered(prop)); } } // If not, append final int slot = _hashCode(key); return new BeanPropertyMap(this, newProp, key, slot); }
/** * Specialized method that can be used to replace an existing entry * (note: entry MUST exist; otherwise exception is thrown) with * specified replacement. * * @since 2.9.4 */ public void replace(SettableBeanProperty origProp, SettableBeanProperty newProp) { int i = 1; int end = _hashArea.length; for (;; i += 2) { if (i > end) { throw new NoSuchElementException("No entry '"+origProp.getName()+"' found, can't replace"); } if (_hashArea[i] == origProp) { _hashArea[i] = newProp; break; } } _propsInOrder[_findFromOrdered(origProp)] = newProp; }
@Deprecated // in 2.9.4 -- must call method that takes old and new property to avoid mismatch public void replace(SettableBeanProperty newProp) { String key = getPropertyName(newProp); int ix = _findIndexInHash(key); if (ix < 0) { throw new NoSuchElementException("No entry '"+key+"' found, can't replace"); } SettableBeanProperty prop = (SettableBeanProperty) _hashArea[ix]; _hashArea[ix] = newProp; // also, replace in in-order _propsInOrder[_findFromOrdered(prop)] = newProp; }
/** * Specialized method that can be used to replace an existing entry * (note: entry MUST exist; otherwise exception is thrown) with * specified replacement. */ public void replace(SettableBeanProperty newProp) { String key = getPropertyName(newProp); int ix = _findIndexInHash(key); if (ix >= 0) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[ix]; _hashArea[ix] = newProp; // also, replace in in-order _propsInOrder[_findFromOrdered(prop)] = newProp; return; } throw new NoSuchElementException("No entry '"+key+"' found, can't replace"); }
if (found) { _propsInOrder[_findFromOrdered(prop)] = null; continue;
if (found) { _propsInOrder[_findFromOrdered(prop)] = null; continue;
if ((prop != null) && prop.getName().equals(key)) { _hashArea[i] = newProp; _propsInOrder[_findFromOrdered(prop)] = newProp; return this;
/** * Fluent copy method that creates a new instance that is a copy * of this instance except for one additional property that is * passed as the argument. * Note that method does not modify this instance but constructs * and returns a new one. */ public BeanPropertyMap withProperty(SettableBeanProperty newProp) { // First: may be able to just replace? String key = getPropertyName(newProp); for (int i = 1, end = _hashArea.length; i < end; i += 2) { SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; if ((prop != null) && prop.getName().equals(key)) { return new BeanPropertyMap(this, newProp, i, _findFromOrdered(prop)); } } // If not, append final int slot = _hashCode(key); return new BeanPropertyMap(this, newProp, key, slot); }