public interface IReferenceHandler
This interface provides infrastructure for both external and internal (i.e. stored in the GraphML document) references.
Usually, it is not necessary to use this interface directly from client code.
Modifier and Type | Method and Description |
---|---|
IReferenceHandle |
getHandle(IWriteContext context,
Object subject)
Gets the reference handle for a given subject.
|
IEnumerable<IReferenceHandle> |
getInternalHandles()
Return a collection of all registered reference handles that should be written to the GraphML shared data section.
|
void |
markAsUnshared(IWriteContext context,
Object subject)
Unregister a shared resource.
|
SharingState |
registerResource(IWriteContext context,
Object subject)
Register a shared resource.
|
IReferenceHandle getHandle(IWriteContext context, Object subject)
subject
- The subject.context
- The current write context.subject
, or null
if the resource is not registered.IReferenceHandle
,
IReferenceHandle.getSubject()
IEnumerable<IReferenceHandle> getInternalHandles()
GraphMLIOHandler.addQueryReferenceIdListener(com.yworks.yfiles.utils.IEventHandler)
,
GraphMLWriter.addQueryReferenceIdListener(com.yworks.yfiles.utils.IEventHandler)
void markAsUnshared(IWriteContext context, Object subject)
This allows to explicitly mark a resource as unshared even if it is referenced multiple times in the object graph. If a
resource has already been registered with registerResource(IWriteContext, Object)
, it will be unmarked. In
addition, subsequent calls to registerResource(IWriteContext, Object)
for the same reference won't mark the
resource as shared again.
context
- The current write context.subject
- The resource to register.registerResource(IWriteContext, Object)
,
GraphML.shareable()
SharingState registerResource(IWriteContext context, Object subject)
context
- The current write context.subject
- The resource to register.true
iff the resource needs to be serialized; otherwise the resource is either a duplicate resource or is
declared externally and does not need any additional handling.