Java Code Examples for com.fasterxml.jackson.databind.deser.SettableBeanProperty#getName()

The following examples show how to use com.fasterxml.jackson.databind.deser.SettableBeanProperty#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanPropertyMap.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: BeanPropertyMap.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: BeanPropertyMap.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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");
}
 
Example 4
Source File: BeanPropertyMap.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected final String getPropertyName(SettableBeanProperty prop) {
    return _caseInsensitive ? prop.getName().toLowerCase() : prop.getName();
}