Interface DecoratingComponent
- All Known Implementing Classes:
TracingEventStorageEngine,TracingSnapshotStore
public interface DecoratingComponent
Implemented by a
ComponentDecorator output class to expose the single delegate it wraps, so code holding a
decorated value can see through it back to whatever it was built from.
decoratedDelegate() must return the immediate delegate -- never this, and never something that
requires further unwrapping this class isn't aware of -- so that unwrapFully(Object) always terminates.
- Since:
- 5.4.0
- Author:
- John Hendrikx
-
Method Summary
Modifier and TypeMethodDescriptionReturns the single delegate this decorator wraps.default ObjectFollows thedecoratedDelegate()chain fromthisdelegate down to its root, returning the first value encountered that is not itself aDecoratingComponent.static @Nullable ObjectunwrapFully(@Nullable Object value) Follows thedecoratedDelegate()chain from the givenvaluedown to its root, returning the first value encountered that is not itself aDecoratingComponent.
-
Method Details
-
decoratedDelegate
Object decoratedDelegate()Returns the single delegate this decorator wraps.- Returns:
- the wrapped delegate; never
null
-
unwrapFully
Follows thedecoratedDelegate()chain fromthisdelegate down to its root, returning the first value encountered that is not itself aDecoratingComponent.- Returns:
- the root delegate at the bottom of this instance's decoration chain; never
null, provided everydecoratedDelegate()in the chain honors its contract
-
unwrapFully
Follows thedecoratedDelegate()chain from the givenvaluedown to its root, returning the first value encountered that is not itself aDecoratingComponent.Returns
valueitself, unchanged, when it is not aDecoratingComponentto begin with.- Parameters:
value- the value to unwrap; may benull, in which casenullis returned- Returns:
- the root delegate at the bottom of
value's decoration chain, orvalueitself if it is not decorated;nullifvalueisnull
-