List of usage examples for com.fasterxml.jackson.databind DatabindContext setAttribute
public abstract DatabindContext setAttribute(Object key, Object value);
From source file:org.emfjson.jackson.databind.EMFContext.java
public static void prepare(DatabindContext ctxt) { if (getResourceSet(ctxt) == null) { ctxt.setAttribute(Attributes.RESOURCE_SET, new ResourceSetImpl()); }/* w w w . j ava 2 s . com*/ if (getEntries(ctxt) == null) { ctxt.setAttribute(Attributes.REFERENCE_ENTRIES, new ReferenceEntries()); } }
From source file:org.emfjson.jackson.databind.EMFContext.java
public static Cache getCache(DatabindContext context) { Cache cache = (Cache) context.getAttribute(Attributes.CACHE); if (cache == null) { context.setAttribute(Attributes.CACHE, cache = new Cache()); }// w w w . j a v a 2 s.c o m return cache; }
From source file:org.emfjson.jackson.databind.EMFContext.java
public static ReferenceEntries getEntries(DatabindContext ctxt) { try {/* w w w .j av a 2s . c o m*/ return (ReferenceEntries) ctxt.getAttribute(Attributes.REFERENCE_ENTRIES); } catch (ClassCastException e) { ReferenceEntries entries = new ReferenceEntries(); ctxt.setAttribute(Attributes.REFERENCE_ENTRIES, entries); return entries; } }