com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey Java Examples
The following examples show how to use
com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey.
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: JsonDeserializationContext.java From gwt-jackson with Apache License 2.0 | 5 votes |
/** * <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 ); }
Example #2
Source File: SimpleObjectIdResolver.java From domino-jackson with Apache License 2.0 | 5 votes |
@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); }
Example #3
Source File: DefaultDeserializationContext.java From lams with GNU General Public License v2.0 | 5 votes |
@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; } }
Example #4
Source File: DefaultJsonDeserializationContext.java From domino-jackson with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * <p>getObjectWithId</p> */ @Override public Object getObjectWithId(IdKey id) { if (null != idToObject) { return idToObject.get(id); } return null; }
Example #5
Source File: DefaultJsonDeserializationContext.java From domino-jackson with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * <p>addObjectId</p> */ @Override public void addObjectId(IdKey id, Object instance) { if (null == idToObject) { idToObject = new HashMap<IdKey, Object>(); } idToObject.put(id, instance); }
Example #6
Source File: ByIdProperty.java From immutables with Apache License 2.0 | 4 votes |
@Override public Object resolveId(IdKey id) { return ImmutableByid.builder() .id(id.key.toString()) .build(); }
Example #7
Source File: AbstractIdentityDeserializationInfo.java From gwt-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public IdKey newIdKey( Object id ) { return new IdKey( type, scope, id ); }
Example #8
Source File: PropertyIdentityDeserializationInfo.java From gwt-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public IdKey newIdKey( Object id ) { return new IdKey( type, scope, id ); }
Example #9
Source File: AbstractIdentityDeserializationInfo.java From domino-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public IdKey newIdKey(Object id) { return new IdKey(type, scope, id); }
Example #10
Source File: PropertyIdentityDeserializationInfo.java From domino-jackson with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public IdKey newIdKey(Object id) { return new IdKey(type, scope, id); }
Example #11
Source File: SimpleObjectIdResolver.java From domino-jackson with Apache License 2.0 | 4 votes |
@Override public Object resolveId(IdKey id) { return (_items == null) ? null : _items.get(id); }
Example #12
Source File: JsonDeserializationContext.java From gwt-jackson with Apache License 2.0 | 3 votes |
/** * <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; }
Example #13
Source File: IdentityDeserializationInfo.java From domino-jackson with Apache License 2.0 | 2 votes |
/** * <p>newIdKey</p> * * @param id Identifier * @return a new {@link com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey} */ IdKey newIdKey(Object id);
Example #14
Source File: DefaultDeserializationContext.java From lams with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example #15
Source File: IdentityDeserializationInfo.java From gwt-jackson with Apache License 2.0 | 2 votes |
/** * <p>newIdKey</p> * * @param id Identifier * @return a new {@link IdKey} */ IdKey newIdKey( Object id );
Example #16
Source File: ObjectIdResolver.java From domino-jackson with Apache License 2.0 | 2 votes |
/** * 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);
Example #17
Source File: ObjectIdResolver.java From domino-jackson with Apache License 2.0 | 2 votes |
/** * 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);