类com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey源码实例Demo

下面列出了怎么用com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: domino-jackson   文件: SimpleObjectIdResolver.java
@Override
public void bindItem(IdKey id, Object ob)
{
    if (_items == null) {
        _items = new HashMap<IdKey,Object>();
    } else if (_items.containsKey(id)) {
        throw new IllegalStateException("Already had POJO for id (" + id.key.getClass().getName() + ") [" + id
                + "]");
    }
    _items.put(id, ob);
}
 
/**
 * {@inheritDoc}
 *
 * <p>addObjectId</p>
 */
@Override
public void addObjectId(IdKey id, Object instance) {
    if (null == idToObject) {
        idToObject = new HashMap<IdKey, Object>();
    }
    idToObject.put(id, instance);
}
 
/**
 * {@inheritDoc}
 *
 * <p>getObjectWithId</p>
 */
@Override
public Object getObjectWithId(IdKey id) {
    if (null != idToObject) {
        return idToObject.get(id);
    }
    return null;
}
 
源代码4 项目: lams   文件: DefaultDeserializationContext.java
@Override
public void checkUnresolvedObjectId() throws UnresolvedForwardReference
{
    if (_objectIds == null) {
        return;
    }
    // 29-Dec-2014, tatu: As per [databind#299], may also just let unresolved refs be...
    if (!isEnabled(DeserializationFeature.FAIL_ON_UNRESOLVED_OBJECT_IDS)) {
        return;
    }
    UnresolvedForwardReference exception = null;
    for (Entry<IdKey,ReadableObjectId> entry : _objectIds.entrySet()) {
        ReadableObjectId roid = entry.getValue();
        if (!roid.hasReferringProperties()) {
            continue;
        }
        // as per [databind#675], allow resolution at this point
        if (tryToResolveUnresolvedObjectId(roid)) {
            continue;
        }
        if (exception == null) {
            exception = new UnresolvedForwardReference(getParser(), "Unresolved forward references for: ");
        }
        Object key = roid.getKey().key;
        for (Iterator<Referring> iterator = roid.referringProperties(); iterator.hasNext(); ) {
            Referring referring = iterator.next();
            exception.addUnresolvedId(key, referring.getBeanType(), referring.getLocation());
        }
    }
    if (exception != null) {
        throw exception;
    }
}
 
源代码5 项目: gwt-jackson   文件: JsonDeserializationContext.java
/**
 * <p>addObjectId</p>
 *
 * @param id a {@link com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey} object.
 * @param instance a {@link java.lang.Object} object.
 */
public void addObjectId( IdKey id, Object instance ) {
    if ( null == idToObject ) {
        idToObject = new HashMap<IdKey, Object>();
    }
    idToObject.put( id, instance );
}
 
源代码6 项目: domino-jackson   文件: SimpleObjectIdResolver.java
@Override
public Object resolveId(IdKey id) {
    return (_items == null) ? null : _items.get(id);
}
 
/** {@inheritDoc} */
@Override
public IdKey newIdKey(Object id) {
    return new IdKey(type, scope, id);
}
 
/** {@inheritDoc} */
@Override
public IdKey newIdKey(Object id) {
    return new IdKey(type, scope, id);
}
 
/** {@inheritDoc} */
@Override
public IdKey newIdKey( Object id ) {
    return new IdKey( type, scope, id );
}
 
/** {@inheritDoc} */
@Override
public IdKey newIdKey( Object id ) {
    return new IdKey( type, scope, id );
}
 
源代码11 项目: immutables   文件: ByIdProperty.java
@Override
public Object resolveId(IdKey id) {
  return ImmutableByid.builder()
      .id(id.key.toString())
      .build();
}
 
源代码12 项目: gwt-jackson   文件: JsonDeserializationContext.java
/**
 * <p>getObjectWithId</p>
 *
 * @param id a {@link com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey} object.
 *
 * @return a {@link java.lang.Object} object.
 */
public Object getObjectWithId( IdKey id ) {
    if ( null != idToObject ) {
        return idToObject.get( id );
    }
    return null;
}
 
源代码13 项目: domino-jackson   文件: ObjectIdResolver.java
/**
 * Method called when a POJO is deserialized and has an Object Identifier.
 * Method exists so that implementation can keep track of existing object in
 * JSON stream that could be useful for further resolution.
 * 
 * @param id The Object Identifer
 * @param pojo The POJO associated to that Identifier
 */
void bindItem(IdKey id, Object pojo);
 
源代码14 项目: domino-jackson   文件: ObjectIdResolver.java
/**
 * Method called when deserialization encounters the given Object Identifier
 * and requires the POJO associated with it.
 * 
 * @param id The Object Identifier
 * @return The POJO, or null if unable to resolve.
 */
Object resolveId(IdKey id);
 
/**
 * <p>newIdKey</p>
 *
 * @param id Identifier
 * @return a new {@link com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey}
 */
IdKey newIdKey(Object id);
 
源代码16 项目: lams   文件: DefaultDeserializationContext.java
/**
 * Overridable factory method to create a new instance of ReadableObjectId or its
 * subclass. It is meant to be overridden when custom ReadableObjectId is
 * needed for {@link #tryToResolveUnresolvedObjectId}.
 * Default implementation simply constructs default {@link ReadableObjectId} with
 * given <code>key</code>.
 * 
 * @param key The key to associate with the new ReadableObjectId
 * @return New ReadableObjectId instance
 *
 * @since 2.7
 */
protected ReadableObjectId createReadableObjectId(IdKey key) {
    return new ReadableObjectId(key);
}
 
源代码17 项目: gwt-jackson   文件: IdentityDeserializationInfo.java
/**
 * <p>newIdKey</p>
 *
 * @param id Identifier
 * @return a new {@link IdKey}
 */
IdKey newIdKey( Object id );
 
 类方法
 同包方法