java.lang.Object
org.jhotdraw8.base.converter.SimpleIdFactory
- All Implemented Interfaces:
IdFactory,IdResolver,IdSupplier
SimpleIdFactory.
- Author:
- Werner Randelshofer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabsolutize(@NonNull URI uri) Absolutize the given external URI, so that it can be used inside of a drawing (e.g.Creates an id for the specified object.Creates an id for the specified object.Creates an id for the specified object.Gets an id for the specified object.Gets the object for the specified id.putIdAndObject(@NonNull String id, @NonNull Object object) Puts the id and the object for mapping between them.putIdToObject(@NonNull String id, @NonNull Object object) Puts the id for mapping to the specified object.relativize(@NonNull URI uri) Relativize the given URI, so that it can be used for storage in a file.voidreset()Clears all ids.voidsetDocumentHome(@Nullable URI documentHome) voidsetUriResolver(@NonNull UriResolver uriResolver) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.base.converter.IdResolver
getObject
-
Constructor Details
-
SimpleIdFactory
public SimpleIdFactory()
-
-
Method Details
-
reset
public void reset()Description copied from interface:IdFactoryClears all ids. -
createId
Description copied from interface:IdFactoryCreates an id for the specified object. If the object already has an id, then that id is returned. -
getId
Description copied from interface:IdSupplierGets an id for the specified object. Returns null if the object has no id.- Specified by:
getIdin interfaceIdSupplier- Parameters:
object- the object- Returns:
- the id
-
setDocumentHome
- Specified by:
setDocumentHomein interfaceIdFactory
-
relativize
Description copied from interface:IdSupplierRelativize the given URI, so that it can be used for storage in a file.In the internal representation of a drawing, we store all URIs with absolute paths.
In the external representation of a drawing, we try to store all URIs relative to the home folder of the document (document home).
- Specified by:
relativizein interfaceIdSupplier- Parameters:
uri- an internal URI (typically an absolute path)- Returns:
- an external URI (typically relative to document home)
-
getObject
Description copied from interface:IdResolverGets the object for the specified id. Returns null if the id has no object.- Specified by:
getObjectin interfaceIdResolver- Parameters:
id- the id or null- Returns:
- the object if present
-
absolutize
Description copied from interface:IdResolverAbsolutize the given external URI, so that it can be used inside of a drawing (e.g. to access data from the URI).In the internal representation of a drawing, we store all URIs with absolute paths.
In the external representation of a drawing, we try to store all URIs relative to the home folder of the document (document home).
- Specified by:
absolutizein interfaceIdResolver- Parameters:
uri- an external URI (typically relative to document home)- Returns:
- an internal URI (typically an absolute path)
-
putIdAndObject
Description copied from interface:IdFactoryPuts the id and the object for mapping between them.If the object already has an id, the old id is replaced.
- Specified by:
putIdAndObjectin interfaceIdFactory- Parameters:
id- the idobject- the object- Returns:
- the object that previously was assigned to this id
-
putIdToObject
Description copied from interface:IdFactoryPuts the id for mapping to the specified object.- Specified by:
putIdToObjectin interfaceIdFactory- Parameters:
id- the idobject- the object- Returns:
- the object that previously was assigned to this id
-
createId
Description copied from interface:IdFactoryCreates an id for the specified object. If the object already has an id, then that id is returned. -
createId
public @Nullable String createId(@NonNull Object object, @Nullable String prefix, @Nullable String suggestedId) Description copied from interface:IdFactoryCreates an id for the specified object. If the object already has an id, then that id is returned. If the object has no id and the suggestedId has not been assigned to an object yet, then the suggestedId is used. -
getUriResolver
-
setUriResolver
-