public interface Asset
extends net.openhft.chronicle.core.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
Asset |
acquireAsset(String childName)
Get or create an asset under this one.
|
default <V> V |
acquireView(Class<V> viewType)
Get or create a view with out a RequestContext.
|
<V> V |
acquireView(Class<V> viewType,
RequestContext requestContext)
Get or create a view based on a RequestContext.
|
default <V> V |
acquireView(RequestContext requestContext)
Get or create a view based on a RequestContext.
|
<V> void |
addLeafRule(Class<V> viewType,
String description,
LeafViewFactory<V> factory)
Add a rule or factory for creating view on demand.
|
<V> V |
addView(Class<V> viewType,
V view)
Add an implementation of a view to the asset..
|
<V,U> void |
addWrappingRule(Class<V> viewType,
String description,
java.util.function.BiPredicate<RequestContext,Asset> predicate,
WrappingViewFactory<V,U> factory,
Class<U> underlyingType)
Add a rule or factory for creating views on demand.
|
<V,U> void |
addWrappingRule(Class<V> viewType,
String description,
WrappingViewFactory<V,U> factory,
Class<U> underlyingType)
Add a rule or factory for creating views on demand.
|
default Asset |
findAsset(String name)
Search a tree to find the first Asset with the name given.
|
default <V> V |
findOrCreateView(Class<V> viewType)
Search up the tree for a view of viewType.
|
default <V> V |
findView(Class<V> viewType)
Search for a view up the tree.
|
void |
forEachChild(net.openhft.chronicle.core.util.ThrowingAcceptor<Asset,InvalidSubscriberException> childAcceptor)
Iterate of all the children of this Asset.
|
default String |
fullName() |
default Asset |
getAsset(String fullName)
Navigate down the tree to find an asset.
|
Asset |
getChild(String name)
Get the child of an asset.
|
<V> V |
getView(Class<V> viewType)
Get a view if it already exists on the current Asset.
|
boolean |
hasChildren()
Is this a leaf node.
|
<V> boolean |
hasFactoryFor(Class<V> viewType)
Determine when an asset has a factory/rule for a viewType type.
|
boolean |
isSubAsset() |
String |
name() |
Asset |
parent() |
<V> void |
registerView(Class<V> viewType,
V view)
Provide a specific implementation of a view
|
void |
removeChild(String name)
Remove a child asset from the tree.
|
default Asset |
root()
Find the root Asset for this tree.
|
Subscription |
subscription(boolean createIfAbsent)
Obtain the default subscription view.
|
String name()
@Nullable Asset parent()
@NotNull default String fullName()
Subscription subscription(boolean createIfAbsent) throws AssetNotFoundException
createIfAbsent - create one if it doesn't exist.AssetNotFoundException - if the Subscription doesn't exist and the tree is not able to create the Subscription.@Nullable default Asset getAsset(@NotNull String fullName)
fullName - with names separated by /@NotNull Asset acquireAsset(String childName) throws AssetNotFoundException
childName - name of the child asset.AssetNotFoundException@Nullable default Asset findAsset(@NotNull String name)
name - partial name of asset to find.@Nullable
default <V> V findView(@NotNull
Class<V> viewType)
viewType - the class pf the view@Nullable
default <V> V findOrCreateView(@NotNull
Class<V> viewType)
throws AssetNotFoundException
viewType - to obtain.AssetNotFoundException<V> boolean hasFactoryFor(Class<V> viewType)
viewType - to look for.Asset getChild(String name)
name - of the child.void removeChild(String name)
name - of the child to remove.@NotNull
default <V> V acquireView(@NotNull
RequestContext requestContext)
throws AssetNotFoundException
requestContext - to use in the construction of the viewAssetNotFoundException - if the Asset could not be created. This can happen if a required rule is not provided.@NotNull <V> V acquireView(Class<V> viewType, RequestContext requestContext) throws AssetNotFoundException
viewType - to obtain.requestContext - to use in the construction of the viewAssetNotFoundException - if the Asset could not be created. This can happen if a required rule is not provided.@NotNull default <V> V acquireView(Class<V> viewType)
viewType - to obtain.AssetNotFoundException - if the Asset could not be created. This can happen if a required rule is not provided.@Nullable <V> V getView(Class<V> viewType)
viewType - the associated interface or class for this view.<V> void registerView(Class<V> viewType, V view)
viewType - interface or class to associate this implementation with.view - implementation of viewType to use.<V> void addLeafRule(Class<V> viewType, String description, LeafViewFactory<V> factory)
viewType - interface to associate this factory with.description - of the factoryfactory - to create a viewType<V,U> void addWrappingRule(Class<V> viewType, String description, WrappingViewFactory<V,U> factory, Class<U> underlyingType)
viewType - class of the view.description - to use to comment on the view, determine order of factories and detect dupliates.factory - to use to create the view. If the factory returns null, the next factory is called.underlyingType - the underlying view type required.<V,U> void addWrappingRule(Class<V> viewType, String description, java.util.function.BiPredicate<RequestContext,Asset> predicate, WrappingViewFactory<V,U> factory, Class<U> underlyingType)
viewType - class of the view.description - to use to comment on the view, determine order of factories and detect dupliates.predicate - to test whether this factory applies.factory - to use to create the view. If the factory returns null, the next factory is called.underlyingType - the underlying view type required.<V> V addView(Class<V> viewType, V view)
viewType - to associate this implementation with.view - boolean isSubAsset()
@NotNull default Asset root()
boolean hasChildren()
void forEachChild(net.openhft.chronicle.core.util.ThrowingAcceptor<Asset,InvalidSubscriberException> childAcceptor) throws InvalidSubscriberException
childAcceptor - to accept each child.InvalidSubscriberException - to throw if the accept is no longer interested in getting more children.Copyright © 2015. All rights reserved.