Example usage for com.fasterxml.jackson.databind DatabindContext getAttribute

List of usage examples for com.fasterxml.jackson.databind DatabindContext getAttribute

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind DatabindContext getAttribute.

Prototype

public abstract Object getAttribute(Object key);

Source Link

Document

Method for accessing attributes available in this context.

Usage

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());
    }//from   w  w w .  j a  va  2s.co  m

    return cache;
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static URI getURI(DatabindContext context) {
    try {//w w w . j a v  a2s  . c  o m
        return (URI) context.getAttribute(Attributes.RESOURCE_URI);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static EObject getParent(DatabindContext ctxt) {
    try {/*from w  ww .ja  v  a 2s. com*/
        return (EObject) ctxt.getAttribute(Attributes.CURRENT_PARENT);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static EClass getRoot(DatabindContext context) {
    try {/*from  ww w.  j  a v a2s  .co  m*/
        return (EClass) context.getAttribute(Attributes.ROOT_ELEMENT);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static EDataType getDataType(DatabindContext ctxt) {
    try {/*w ww .j  av a2  s. c  om*/
        return (EDataType) ctxt.getAttribute(Attributes.CURRENT_DATATYPE);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static EReference getReference(DatabindContext ctxt) {
    try {//from  w  w w.j  a va2 s.c o m
        return (EReference) ctxt.getAttribute(Attributes.CURRENT_REFERENCE);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static Resource getResource(DatabindContext context) {
    try {//  w  w w  .  j  a va 2 s . c o  m
        return (Resource) context.getAttribute(Attributes.RESOURCE);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static ResourceSet getResourceSet(DatabindContext context) {
    try {//w  ww  . j ava 2 s.co  m
        return (ResourceSet) context.getAttribute(Attributes.RESOURCE_SET);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static EStructuralFeature getFeature(DatabindContext ctxt) {
    try {/*from ww  w  .j  ava 2s  .c  o  m*/
        return (EStructuralFeature) ctxt.getAttribute(Attributes.CURRENT_FEATURE);
    } catch (ClassCastException e) {
        return null;
    }
}

From source file:org.emfjson.jackson.databind.EMFContext.java

public static ReferenceEntries getEntries(DatabindContext ctxt) {
    try {/*from  ww  w. ja  v a2s  .  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;
    }
}