|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl org.eclipse.emf.ecore.xmi.impl.ResourceEntityHandlerImpl
public class ResourceEntityHandlerImpl
This resource entity handler implementation extends the URI handler implementation
so that this object can be used as both a resource entity handler and a URI handler
since it's far more efficient to deresolve a URI once to compute the entity value
than to deresolve it for each use and then map that deresolved result to an entity.
For this reason, this implementation overrides deresolve(org.eclipse.emf.common.util.URI)
to return the incoming URI.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl |
---|
URIHandlerImpl.PlatformSchemeAware |
Field Summary | |
---|---|
protected int |
count
|
protected java.lang.String |
entityName
|
protected java.util.Map<java.lang.String,java.lang.String> |
nameToValueMap
|
protected java.util.Map<java.lang.String,java.lang.String> |
valueToNameMap
|
Fields inherited from class org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl |
---|
baseURI, resolve |
Constructor Summary | |
---|---|
ResourceEntityHandlerImpl(java.lang.String entityName)
Creates an instance that will generate entity names based on the given entity name followed by the count starting from 1 to ensure uniqueness. |
Method Summary | |
---|---|
URI |
deresolve(URI uri)
Returns the given URI. |
protected URI |
doDeresolve(URI uri)
Returns the deresolved URI by calling super. |
protected void |
doSetBaseURI(URI uri)
Sets the base URI by calling super. |
protected java.lang.String |
generateEntityName(java.lang.String entityValue)
Generates a new unique entity name for the given entity value. |
java.lang.String |
getEntityName(java.lang.String entityValue)
Returns the name associated with the entity value; a new name will be generated if there is not yet a name associated with the entity value. |
java.util.Map<java.lang.String,java.lang.String> |
getNameToValueMap()
Returns the map of entity names to entity values to be recorded in the document during save. |
void |
handleEntity(java.lang.String entityName,
java.lang.String entityValue)
Records the entity name to entity value mapping. |
void |
reset()
Resets the handler to its initial state. |
void |
setBaseURI(URI uri)
Sets the base URI and if the URI has changed, resolves all the entity URIs values against the old base URI and then deresolves them against the new baseURI. |
Methods inherited from class org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl |
---|
resolve |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String entityName
protected int count
protected java.util.Map<java.lang.String,java.lang.String> nameToValueMap
protected java.util.Map<java.lang.String,java.lang.String> valueToNameMap
Constructor Detail |
---|
public ResourceEntityHandlerImpl(java.lang.String entityName)
count
starting from 1 to ensure uniqueness.
entityName
- Method Detail |
---|
public URI deresolve(URI uri)
deresolve
in interface XMLResource.URIHandler
deresolve
in class URIHandlerImpl
uri
- the URI to deresolve.
URI.deresolve(URI)
protected URI doDeresolve(URI uri)
uri
- the URI to deresolve.public void setBaseURI(URI uri)
setBaseURI
in interface XMLResource.URIHandler
setBaseURI
in class URIHandlerImpl
uri
- the new base URI.protected void doSetBaseURI(URI uri)
uri
- public void reset()
reset
in interface XMLResource.ResourceEntityHandler
public java.lang.String getEntityName(java.lang.String entityValue)
XMLResource.ResourceEntityHandler
getEntityName
in interface XMLResource.ResourceEntityHandler
entityValue
- the entity value for which a named entity is needed.
protected java.lang.String generateEntityName(java.lang.String entityValue)
entityValue
- the value for which an entity name is needed.
public void handleEntity(java.lang.String entityName, java.lang.String entityValue)
XMLResource.ResourceEntityHandler
handleEntity
in interface XMLResource.ResourceEntityHandler
entityName
- the name of the entity.entityValue
- the associated value of the entity.public java.util.Map<java.lang.String,java.lang.String> getNameToValueMap()
XMLResource.ResourceEntityHandler
getNameToValueMap
in interface XMLResource.ResourceEntityHandler
|
Copyright 2001-2012 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |