All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.databind.util.ObjectIdMap Maven / Gradle / Ivy

Go to download

Ehcache is an open source, standards-based cache used to boost performance, offload the database and simplify scalability. Ehcache is robust, proven and full-featured and this has made it the most widely-used Java-based cache.

There is a newer version: 2.10.9.2
Show newest version
package com.fasterxml.jackson.databind.util;

import java.util.IdentityHashMap;

/**
 * Map used during serialization, to keep track of referable Objects
 * along with lazily evaluated ids.
 */
@SuppressWarnings("serial")
public class ObjectIdMap extends IdentityHashMap
{
    public ObjectIdMap()
    {
        super(16);
    }

    /*
    /**********************************************************
    /* API
    /**********************************************************
     */

    /**
     * Method that is called to figure out whether we have already
     * seen given POJO: if yes, we will return its id (first looking
     * it up as necessary); if not, we will mark down that we have
     * seen it but return null.
     */
    public Object findId(Object pojo)
    {
        return get(pojo);
    }
    
    public void insertId(Object pojo, Object id)
    {
        put(pojo, id);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy