public static URI getURI(DatabindContext context) { try { return (URI) context.getAttribute(Attributes.RESOURCE_URI); } catch (ClassCastException e) { return null; } }
public static EDataType getDataType(DatabindContext ctxt) { try { return (EDataType) ctxt.getAttribute(Internals.CURRENT_DATATYPE); } catch (ClassCastException e) { return null; } }
public static EReference getReference(DatabindContext ctxt) { try { return (EReference) ctxt.getAttribute(Internals.CURRENT_FEATURE); } catch (ClassCastException e) { return null; } }
public static EDataType getDataType(DatabindContext ctxt) { try { return (EDataType) ctxt.getAttribute(Internals.CURRENT_DATATYPE); } catch (ClassCastException e) { return null; } }
public static EClass getRoot(DatabindContext context) { try { return (EClass) context.getAttribute(Attributes.ROOT_ELEMENT); } catch (ClassCastException e) { return null; } }
public static EReference getReference(DatabindContext ctxt) { try { return (EReference) ctxt.getAttribute(Internals.CURRENT_FEATURE); } catch (ClassCastException e) { return null; } }
public static URI getURI(DatabindContext context) { try { return (URI) context.getAttribute(Attributes.RESOURCE_URI); } catch (ClassCastException e) { return null; } }
public static Resource getResource(DatabindContext context) { try { return (Resource) context.getAttribute(Attributes.RESOURCE); } catch (ClassCastException e) { return null; } }
public static EClass getRoot(DatabindContext context) { try { return (EClass) context.getAttribute(Attributes.ROOT_ELEMENT); } catch (ClassCastException e) { return null; } }
public static EObject getParent(DatabindContext ctxt) { try { return (EObject) ctxt.getAttribute(Internals.CURRENT_PARENT); } catch (ClassCastException e) { return null; } }
public static EStructuralFeature getFeature(DatabindContext ctxt) { try { return (EStructuralFeature) ctxt.getAttribute(Internals.CURRENT_FEATURE); } catch (ClassCastException e) { return null; } }
public static EStructuralFeature getFeature(DatabindContext ctxt) { try { return (EStructuralFeature) ctxt.getAttribute(Internals.CURRENT_FEATURE); } catch (ClassCastException e) { return null; } }
public static EClass findEClassByName(DatabindContext ctxt, String name) { @SuppressWarnings("unchecked") Set<EClass> types = (Set<EClass>) ctxt.getAttribute(Internals.ALL_TYPES); if (types == null) { types = initAllTypes(ctxt); } return types.stream().filter(findByName(name)).findFirst().orElse(null); }
public static EClass findEClassByQualifiedName(DatabindContext ctxt, String name) { @SuppressWarnings("unchecked") Set<EClass> types = (Set<EClass>) ctxt.getAttribute(Internals.ALL_TYPES); if (types == null) { types = initAllTypes(ctxt); } return types.stream().filter(findByQualifiedName(name)).findFirst().orElse(null); }
public static ReferenceEntries getEntries(DatabindContext ctxt) { try { return (ReferenceEntries) ctxt.getAttribute(Internals.REFERENCE_ENTRIES); } catch (ClassCastException e) { ReferenceEntries entries = new ReferenceEntries(); ctxt.setAttribute(Internals.REFERENCE_ENTRIES, entries); return entries; } }
public static EcoreTypeFactory getTypeFactory(DatabindContext ctxt) { EcoreTypeFactory factory = (EcoreTypeFactory) ctxt.getAttribute(Internals.TYPE_FACTORY); if (factory == null) { ctxt.setAttribute(Internals.TYPE_FACTORY, factory = new EcoreTypeFactory()); } return factory; }
public static ResourceSet getResourceSet(DatabindContext context) { ResourceSet resourceSet; try { resourceSet = (ResourceSet) context.getAttribute(Attributes.RESOURCE_SET); } catch (ClassCastException e) { resourceSet = null; } if (resourceSet == null) { context.setAttribute(Attributes.RESOURCE_SET, resourceSet = new ResourceSetImpl()); } return resourceSet; }
public static ResourceSet getResourceSet(DatabindContext context) { ResourceSet resourceSet; try { resourceSet = (ResourceSet) context.getAttribute(Attributes.RESOURCE_SET); } catch (ClassCastException e) { resourceSet = null; } if (resourceSet == null) { context.setAttribute(Attributes.RESOURCE_SET, resourceSet = new ResourceSetImpl()); } return resourceSet; }
public static ReferenceEntries getEntries(DatabindContext ctxt) { try { return (ReferenceEntries) ctxt.getAttribute(Internals.REFERENCE_ENTRIES); } catch (ClassCastException e) { ReferenceEntries entries = new ReferenceEntries(); ctxt.setAttribute(Internals.REFERENCE_ENTRIES, entries); return entries; } }
@Deprecated public static void prepare(DatabindContext ctxt) { if (ctxt.getAttribute(Internals.INIT) != null) { return; } if (getResourceSet(ctxt) == null) { ctxt.setAttribute(Attributes.RESOURCE_SET, new ResourceSetImpl()); } if (getEntries(ctxt) == null) { ctxt.setAttribute(Internals.REFERENCE_ENTRIES, new ReferenceEntries()); } }