public final class IdRepository extends Object
Constructor and Description |
---|
IdRepository() |
Modifier and Type | Method and Description |
---|---|
String |
changeId(Object obj,
String newId)
Changes the associated id of an object.
|
String |
changeId(String oldId,
String newId)
Changes the id associated of an object.
|
String |
checkId(String myId,
Object obj)
Checks id availability, if the id doesn't exist before then registers the
couple Id/object, else an error is thrown.
|
void |
eraseIt()
Erase the content of the Id repository
|
boolean |
fuseWith(IdRepository otherIdRep)
Returns true if no id are common between current and given IdRepository.
|
String |
generateFreeId(Object obj)
Generates an unused id and link an object to it.
|
String |
generateFreeId(String prefix,
Object obj)
Generates an unused id and link an object to it.
|
String |
generatePrefix()
Generates a prefix.
|
Set<String> |
getAllId() |
Map<String,Object> |
getMap() |
Object |
getObject(String theId)
Returns the object with the given id.
|
Boolean |
isCompatible(IdRepository otherIdRep)
Returns true if no id are common between current and given IdRepository.
|
Object |
remove(String theId)
Removes an id/object association from the id repository.
|
public final void eraseIt()
public final String checkId(String myId, Object obj) throws InvalidIDException
myId
- suffix keyobj
- the object which has this idInvalidIDException
- raise exception if invalid idpublic final String generateFreeId(String prefix, Object obj) throws InvalidIDException
prefix
- a prefix for the id, must begin with a letter, may be pnml
object type.obj
- the object which will be linked to this id.InvalidIDException
- raise exception if a problem occurs, typically the prefix
is null, empty, or begins with a digit.generateFreeId(Object)
public final String generateFreeId(Object obj) throws InvalidIDException
obj
- the object that will be linked to this id.InvalidIDException
generateFreeId(String, Object)
public final String generatePrefix()
public final Object getObject(String theId) throws InvalidIDException
theId
- the id to find.InvalidIDException
- if no object with this id is found.public final Object remove(String theId) throws InvalidIDException
theId
- the id to removeInvalidIDException
- if the id doesn't existspublic final String changeId(String oldId, String newId) throws InvalidIDException
oldId
- the id to changenewId
- the new id to giveInvalidIDException
- if the old id doesn't exists or if the new one is already
usedpublic final String changeId(Object obj, String newId) throws OtherException, InvalidIDException
obj
- the object of which id must be changenewId
- the new id to give to the objectOtherException
- if the object doesn't exist.InvalidIDException
- if the new id is not validpublic final Boolean isCompatible(IdRepository otherIdRep)
otherIdRep
- the repository to compare with current onepublic final boolean fuseWith(IdRepository otherIdRep)
otherIdRep
- the repository to fuse with current oneCopyright © 2009–2016 Univ. Paris Ouest, and Univ. Pierre et Marie Curie / CNRS UMR 7606 (LIP6). All rights reserved.