下面列出了com.fasterxml.jackson.databind.deser.SettableBeanProperty#getName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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;
}
/**
* Specialized method for removing specified existing entry.
* NOTE: entry MUST exist, otherwise an exception is thrown.
*/
public void remove(SettableBeanProperty propToRm)
{
ArrayList<SettableBeanProperty> props = new ArrayList<SettableBeanProperty>(_size);
String key = getPropertyName(propToRm);
boolean found = false;
for (int i = 1, end = _hashArea.length; i < end; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i];
if (prop == null) {
continue;
}
if (!found) {
// 09-Jan-2017, tatu: Important: must check name slot and NOT property name,
// as only former is lower-case in case-insensitive case
found = key.equals(_hashArea[i-1]);
if (found) {
// need to leave a hole here
_propsInOrder[_findFromOrdered(prop)] = null;
continue;
}
}
props.add(prop);
}
if (!found) {
throw new NoSuchElementException("No entry '"+propToRm.getName()+"' found, can't remove");
}
init(props);
}
private final int _findFromOrdered(SettableBeanProperty prop) {
for (int i = 0, end = _propsInOrder.length; i < end; ++i) {
if (_propsInOrder[i] == prop) {
return i;
}
}
throw new IllegalStateException("Illegal state: property '"+prop.getName()+"' missing from _propsInOrder");
}
protected final String getPropertyName(SettableBeanProperty prop) {
return _caseInsensitive ? prop.getName().toLowerCase() : prop.getName();
}