public class ResourceEntityHandlerImpl extends URIHandlerImpl implements XMLResource.ResourceEntityHandler
deresolve(org.eclipse.emf.common.util.URI)
to return the incoming URI.URIHandlerImpl.AbsoluteCrossBundleAware, URIHandlerImpl.PlatformSchemeAware
Modifier and Type | Field and Description |
---|---|
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 |
baseURI, resolve
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
getBaseURI, resolve
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
public ResourceEntityHandlerImpl(java.lang.String entityName)
count
starting from 1 to ensure uniqueness.entityName
- 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