Package io.foldright.inspectablewrappers
Interface Attachable<K,V>
- Type Parameters:
K- the key type, requirements depending on which storage is usedV- the value type to be stored
- All Known Implementing Classes:
AttachableDelegate
public interface Attachable<K,V>
This
Attachable interface is used to be implemented by wrapper classes,
provide the attachment storage ability.
Retrieves the attachment from wrapper chain
by method Inspector.getAttachmentFromWrapperChain(Object, Object).
Provided AttachableDelegate
as a simple delegate implementation.
- Author:
- Jerry Lee (oldratlee at gmail dot com), Yang Fang (snoop dot fy at gmail dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAttachment_(K key) Gets the attachment value for the given key.voidsetAttachment_(K key, V value) Sets an attachment.
-
Method Details
-
setAttachment_
Sets an attachment.- Parameters:
key- the attachment keyvalue- the attachment value- Throws:
NullPointerException- if any arguments is null
-
getAttachment_
Gets the attachment value for the given key.- Parameters:
key- the attachment key- Returns:
- return the attachment value, or
nullif contains no attachment for the key - Throws:
NullPointerException- if key argument is nullClassCastException- if the return value is not type<V>- See Also:
-