public class VanillaSubAsset<E> extends Object implements SubAsset<E>, net.openhft.chronicle.core.io.Closeable, TopicSubscriber<String,E>
| Modifier and Type | Method and Description |
|---|---|
Asset |
acquireAsset(String childName)
Get or create an asset under this one.
|
<V> V |
acquireView(Class<V> viewType,
RequestContext rc)
Get or create a view based on a RequestContext.
|
<L> void |
addLeafRule(Class<L> viewType,
String description,
LeafViewFactory<L> 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..
|
<W,U> void |
addWrappingRule(Class<W> viewType,
String description,
java.util.function.BiPredicate<RequestContext,Asset> predicate,
WrappingViewFactory<W,U> factory,
Class<U> underlyingType)
Add a rule or factory for creating views on demand.
|
<W,U> void |
addWrappingRule(Class<W> viewType,
String description,
WrappingViewFactory<W,U> factory,
Class<U> underlyingType)
Add a rule or factory for creating views on demand.
|
void |
close() |
void |
forEachChild(net.openhft.chronicle.core.util.ThrowingAcceptor<Asset,InvalidSubscriberException> childAcceptor)
Iterate of all the children of this 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() |
boolean |
keyedView()
If you attach a keyed view to an Asset, it is assumed that any child asset with be a SubAsset.
|
String |
name() |
void |
onMessage(String name,
E e)
Called when a topic in a group has an new message/event
|
Asset |
parent() |
<I> void |
registerView(Class<I> viewType,
I view)
Provide a specific implementation of a view
|
void |
removeChild(String name)
Remove a child asset from the tree.
|
Subscription |
subscription(boolean createIfAbsent)
Obtain the default subscription view.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitacquireView, acquireView, findAsset, findOrCreateView, findView, fullName, getAsset, rootonEndOfSubscription@NotNull public Subscription subscription(boolean createIfAbsent)
Assetsubscription in interface AssetcreateIfAbsent - create one if it doesn't exist.@NotNull public <V> V getView(Class<V> viewType)
Assetpublic String name()
@NotNull
public <V> V acquireView(@NotNull
Class<V> viewType,
@NotNull
RequestContext rc)
throws AssetNotFoundException
AssetacquireView in interface AssetviewType - to obtain.rc - 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.public <V> V addView(Class<V> viewType, V view)
Assetpublic boolean isSubAsset()
isSubAsset in interface Assetpublic boolean hasChildren()
AssethasChildren in interface Assetpublic <I> void registerView(Class<I> viewType, I view)
AssetregisterView in interface AssetviewType - interface or class to associate this implementation with.view - implementation of viewType to use.public <W,U> void addWrappingRule(Class<W> viewType, String description, java.util.function.BiPredicate<RequestContext,Asset> predicate, WrappingViewFactory<W,U> factory, Class<U> underlyingType)
AssetaddWrappingRule in interface AssetviewType - 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.public <W,U> void addWrappingRule(Class<W> viewType, String description, WrappingViewFactory<W,U> factory, Class<U> underlyingType)
AssetaddWrappingRule in interface AssetviewType - 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.public <L> void addLeafRule(Class<L> viewType, String description, LeafViewFactory<L> factory)
AssetaddLeafRule in interface AssetviewType - interface to associate this factory with.description - of the factoryfactory - to create a viewTypepublic void close()
close in interface Closeableclose in interface AutoCloseablepublic Asset parent()
@NotNull public Asset acquireAsset(String childName) throws AssetNotFoundException
AssetacquireAsset in interface AssetchildName - name of the child asset.AssetNotFoundExceptionpublic <V> boolean hasFactoryFor(Class<V> viewType)
AssethasFactoryFor in interface AssetviewType - to look for.@NotNull public Asset getChild(String name)
Assetpublic void removeChild(String name)
AssetremoveChild in interface Assetname - of the child to remove.public void onMessage(@NotNull
String name,
E e)
TopicSubscriberonMessage in interface TopicSubscriber<String,E>name - the message was associated withe - publishedpublic boolean keyedView()
Viewpublic void forEachChild(net.openhft.chronicle.core.util.ThrowingAcceptor<Asset,InvalidSubscriberException> childAcceptor) throws InvalidSubscriberException
AssetforEachChild in interface AssetchildAcceptor - to accept each child.InvalidSubscriberException - to throw if the accept is no longer interested in getting more children.Copyright © 2015. All rights reserved.