public final class NullObjectTypeReferenceHandler extends Object implements ObjectTypeReferenceHandler
ObjectTypeReferenceHandler which handles
no reference.
Take into account that according to the contract defined in ObjectTypeReferenceHandler,
each time any of these methods return Optional.empty() the invoker has the responsibility
to resolve the type somehow else.| Constructor and Description |
|---|
NullObjectTypeReferenceHandler() |
| Modifier and Type | Method and Description |
|---|---|
Optional<TypeBuilder> |
readReference(String typeId)
Returns a
TypeBuilder referenced by the given typeId. |
Optional<String> |
writeReference(ObjectType type,
com.google.gson.stream.JsonWriter writer)
Uses the
writer to write a reference to the given type. |
public Optional<String> writeReference(ObjectType type, com.google.gson.stream.JsonWriter writer)
writer to write a reference to the given type.
This method returns the written reference, so that it can be used as an id
to deserialize. However, some implementations might be unable to handle
some specific types, which is why the reference might be Optional.empty().
In such case, it's the invoker responsibility to either attempt using a different implementation of this contract or to just treat the type explicitly instead of through a reference.
writeReference in interface ObjectTypeReferenceHandlertype - the type to writewriter - a JsonWriterOptional.empty()public Optional<TypeBuilder> readReference(String typeId)
TypeBuilder referenced by the given typeId.
If the reference cannot be handled or points to an unknown type it returns
Optional.empty()readReference in interface ObjectTypeReferenceHandlertypeId - a type idOptional TypeBuilderCopyright © 2022 MuleSoft, Inc.. All rights reserved.