org.eclipse.emf.ecore.impl
Class EPackageRegistryImpl

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.Object>
          extended by org.eclipse.emf.ecore.impl.EPackageRegistryImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>, EPackage.Registry

public class EPackageRegistryImpl
extends java.util.HashMap<java.lang.String,java.lang.Object>
implements EPackage.Registry

An implementation of a package registry that can delegate failed lookup to another registry.

See Also:
Serialized Form

Nested Class Summary
static class EPackageRegistryImpl.Delegator
          A package registry implementation that delegates to a class loader specific registry.
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected static java.util.Map<java.lang.ClassLoader,EPackage.Registry> classLoaderToRegistryMap
          A map from class loader to its associated registry.
protected  EPackage.Registry delegateRegistry
          The delegate registry.
 
Fields inherited from interface org.eclipse.emf.ecore.EPackage.Registry
INSTANCE
 
Constructor Summary
EPackageRegistryImpl()
          Creates a non-delegating instance.
EPackageRegistryImpl(EPackage.Registry delegateRegistry)
          Creates a delegating instance.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Returns whether this map or the delegate map contains this key.
static EPackage.Registry createGlobalRegistry()
          Creates the instance of the global registry.
protected  EFactory delegatedGetEFactory(java.lang.String nsURI)
          Returns the factory from the delegate registry, if there is one.
protected  EPackage delegatedGetEPackage(java.lang.String nsURI)
          Returns the package from the delegate registry, if there is one.
 EFactory getEFactory(java.lang.String nsURI)
          Looks up the value in the map, converting EPackage.Descriptor objects to EFactory objects on demand.
 EPackage getEPackage(java.lang.String nsURI)
          Looks up the value in the map, converting EPackage.Descriptor objects to EPackage objects on demand.
static EPackage.Registry getRegistry(java.lang.ClassLoader classLoader)
          Returns the package registry associated with the given class loader.
protected  void initialize(EPackage ePackage)
          Creates a delegating instance.
 
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

delegateRegistry

protected EPackage.Registry delegateRegistry
The delegate registry.


classLoaderToRegistryMap

protected static java.util.Map<java.lang.ClassLoader,EPackage.Registry> classLoaderToRegistryMap
A map from class loader to its associated registry.

Constructor Detail

EPackageRegistryImpl

public EPackageRegistryImpl()
Creates a non-delegating instance.


EPackageRegistryImpl

public EPackageRegistryImpl(EPackage.Registry delegateRegistry)
Creates a delegating instance.

Method Detail

createGlobalRegistry

public static EPackage.Registry createGlobalRegistry()
Creates the instance of the global registry. If a security manager is active, and "classLoader" permission is not granted, a secure delegator instance is created, i.e., a private registry implementation that securely accesses class loaders and keeps them private, will be used.


getEPackage

public EPackage getEPackage(java.lang.String nsURI)
Description copied from interface: EPackage.Registry
Looks up the value in the map, converting EPackage.Descriptor objects to EPackage objects on demand.

Specified by:
getEPackage in interface EPackage.Registry

getEFactory

public EFactory getEFactory(java.lang.String nsURI)
Description copied from interface: EPackage.Registry
Looks up the value in the map, converting EPackage.Descriptor objects to EFactory objects on demand.

Specified by:
getEFactory in interface EPackage.Registry

initialize

protected void initialize(EPackage ePackage)
Creates a delegating instance.


delegatedGetEPackage

protected EPackage delegatedGetEPackage(java.lang.String nsURI)
Returns the package from the delegate registry, if there is one.

Returns:
the package from the delegate registry.

delegatedGetEFactory

protected EFactory delegatedGetEFactory(java.lang.String nsURI)
Returns the factory from the delegate registry, if there is one.

Returns:
the factory from the delegate registry.

containsKey

public boolean containsKey(java.lang.Object key)
Returns whether this map or the delegate map contains this key. Note that if there is a delegate map, the result of this method may not be the same as keySet().contains(key).

Specified by:
containsKey in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
containsKey in class java.util.HashMap<java.lang.String,java.lang.Object>
Parameters:
key - the key whose presence in this map is to be tested.
Returns:
whether this map or the delegate map contains this key.

getRegistry

public static EPackage.Registry getRegistry(java.lang.ClassLoader classLoader)
Returns the package registry associated with the given class loader.

Parameters:
classLoader - the class loader.
Returns:
the package registry associated with the given class loader.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.