java.lang.Object
org.microbean.loader.spi.AbstractProvider
org.microbean.loader.spi.AbstractTreeBasedProvider<TreeNode>
org.microbean.loader.jackson.JacksonProvider
- All Implemented Interfaces:
Provider
- Direct Known Subclasses:
InputStreamJacksonProvider
A partial
AbstractTreeBasedProvider implementation backed
by Jackson.- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a newJacksonProvider.protectedJacksonProvider(Type lowerBound) Creates a newJacksonProvider. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanReturnstrueif the suppliednodeisnull, absent or synthetic.final TreeNodeReturns the child node of the supplied parentnodeidentified by the suppliedindex, ornullif either the child does not exist ornodeis not a list node.final TreeNodeReturns the child node of the supplied parentnodeidentified by the suppliedname, ornullif either the child does not exist ornodeis not a map node.final booleanReturnstrueif the suppliednoderepresents a list or an array, and therefore theAbstractTreeBasedProvider.get(Object, int)method is likely to be relevant.final booleanReturnstrueif the suppliednoderepresents a map, and therefore theAbstractTreeBasedProvider.get(Object, String)method is likely to be relevant.Returns anIteratorover the names of the suppliednode's child nodes, or an emptyIteratorif the suppliednodeis not a map node.final booleanReturnstrueif the suppliednodeisnullor represents an explicitly setnullvalue.protected abstract ObjectCodecobjectCodec(Loader<?> requestor, Path<? extends Type> absolutePath) Returns anObjectCodecsuitable for the combination of the suppliedLoaderandPath, ornullif there is no suchObjectCodec.protected TreeNodequalifiers(TreeNode node) Returns a node possibly containing qualifiers applicable to the supplied node, ornull.protected BiFunction<? super TreeNode,? super Type, ?> Returns aBiFunctionaccepting a node and aTypeand returning the result of reading an object of that type, ornullif no suchBiFunctioncould be sourced.final intReturns the number of child nodes the suppliednodehas, which may be (and often is)0.Methods inherited from class org.microbean.loader.spi.AbstractTreeBasedProvider
container, find, path, path, qualifiers, rootNodeMethods inherited from class org.microbean.loader.spi.AbstractProvider
get, lowerBound
-
Constructor Details
-
JacksonProvider
protected JacksonProvider()Creates a newJacksonProvider.- See Also:
-
JacksonProvider
Creates a newJacksonProvider.- Parameters:
lowerBound- the lower type bound of thisJacksonProviderimplementation; may benull
-
-
Method Details
-
size
Description copied from class:AbstractTreeBasedProviderReturns the number of child nodes the suppliednodehas, which may be (and often is)0.If the supplied
nullisnull, absent or a scalar, an override of this method must return0.- Specified by:
sizein classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the parent node; may benullin which case0must be returned- Returns:
- the number of child nodes the supplied
nodehas, which may be (and often is)0
-
names
Description copied from class:AbstractTreeBasedProviderReturns anIteratorover the names of the suppliednode's child nodes, or an emptyIteratorif the suppliednodeis not a map node.- Specified by:
namesin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the parent node; may benullin which case an emptyIteratormust be returned- Returns:
- an
Iterator; nevernull
-
get
Description copied from class:AbstractTreeBasedProviderReturns the child node of the supplied parentnodeidentified by the suppliedname, ornullif either the child does not exist ornodeis not a map node.- Specified by:
getin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the parent node; may benullin which casenullmust be returnedname- the name of the child; must not benull- Returns:
- the child node of the supplied parent
nodeidentified by the suppliedname, ornullif either the child does not exist ornodeis not a map node
-
get
Description copied from class:AbstractTreeBasedProviderReturns the child node of the supplied parentnodeidentified by the suppliedindex, ornullif either the child does not exist ornodeis not a list node.- Specified by:
getin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the parent node; may benullin which casenullmust be returnedindex- the zero-based index of the child- Returns:
- the child node of the supplied parent
nodeidentified by the suppliedname, ornullif either the child does not exist ornodeis not a map node
-
absent
Description copied from class:AbstractTreeBasedProviderReturnstrueif the suppliednodeisnull, absent or synthetic.- Specified by:
absentin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the node to test; may benullin which casetruemust be returned- Returns:
trueif the suppliednodeisnull, absent or synthetic
-
nil
Description copied from class:AbstractTreeBasedProviderReturnstrueif the suppliednodeisnullor represents an explicitly setnullvalue.- Specified by:
nilin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the node to test; may benullin which casetruemust be returned- Returns:
trueif the suppliednodeisnullor represents an explicitly setnullvalue
-
map
Description copied from class:AbstractTreeBasedProviderReturnstrueif the suppliednoderepresents a map, and therefore theAbstractTreeBasedProvider.get(Object, String)method is likely to be relevant.- Specified by:
mapin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the node to test; may benullin which casefalsemust be returned- Returns:
trueif the suppliednoderepresents a map, and therefore theAbstractTreeBasedProvider.get(Object, String)method is likely to be relevant
-
list
Description copied from class:AbstractTreeBasedProviderReturnstrueif the suppliednoderepresents a list or an array, and therefore theAbstractTreeBasedProvider.get(Object, int)method is likely to be relevant.- Specified by:
listin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the node to test; may benullin which casefalsemust be returned- Returns:
trueif the suppliednoderepresents a list or an array, and therefore theAbstractTreeBasedProvider.get(Object, int)method is likely to be relevant
-
qualifiers
Description copied from class:AbstractTreeBasedProviderReturns a node possibly containing qualifiers applicable to the supplied node, ornull.- Specified by:
qualifiersin classAbstractTreeBasedProvider<TreeNode>- Parameters:
node- the node for which a corresponding qualifiers node should be returned; may benullin which casenullmust be returned- Returns:
- a node possibly containing qualifiers applicable to the
supplied node, or
null
-
objectCodec
Returns anObjectCodecsuitable for the combination of the suppliedLoaderandPath, ornullif there is no suchObjectCodec.This method is called by the
AbstractProvider.get(Loader, Path)method in the normal course of events.- Parameters:
requestor- theLoaderseeking aValue; must not benullabsolutePath- an absolutePathfor which the suppliedLoaderis seeking a value; must not benull- Returns:
- an
ObjectCodecsuitable for the combination of the suppliedLoaderandPath, ornull - Idempotency:
- Implementations of this method must be idempotent, but not necessarily deterministic.
- Nullability:
- Implementations of this method may return
null. - Thread Safety:
- Implementations of this method must be safe for concurrent use by multiple threads.
-
reader
protected BiFunction<? super TreeNode,? super Type, reader?> (Loader<?> requestor, Path<? extends Type> absolutePath) Description copied from class:AbstractTreeBasedProviderReturns aBiFunctionaccepting a node and aTypeand returning the result of reading an object of that type, ornullif no suchBiFunctioncould be sourced.- Specified by:
readerin classAbstractTreeBasedProvider<TreeNode>- Parameters:
requestor- theLoadercurrently executing a request; must not benullabsolutePath- the path being requested; must not benulland must be absolute- Returns:
- a
BiFunctionaccepting a node and aTypeand returning the result of reading an object of that type, ornullif no suchBiFunctioncould be sourced
-