public abstract class Library extends Node
GenerateLibrary. Implementations for the abstract methods specified in this classes are not supposed to be implemented manually.
|Modifier||Constructor and Description|
Default constructor for sub-classes.
|Modifier and Type||Method and Description|
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, lookupContextReference, lookupLanguageReference, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, toString
public abstract boolean accepts(Object receiver)
trueif this library instance supports sending messages with the given receiver. If accepts returns
falseand a library message is sent anyway then an
AssertionErroris thrown if assertions are enabled (-ea). Otherwise a
ClassCastExceptionmay be thrown by the method.
A library that was created using a receiver value i.e. a
LibraryFactory.create(Object) only guarantees to accept the value it was constructed
with. For other values, the method may return
false. Such libraries need to
check for acceptance before calling a library method with a receiver. If receiver values are
not accepted then a new library needs to be created or fetched. Dispatched versions of
libraries always return
true for any value as they take care of dispatching to
any receiver type.
It is not necessary to call accepts manually for most use cases. Instead the
CachedLibrary should be used instead. For slow-paths the
internally dispatched versions of the uncached library
should be used.
The accepts message may be exported by receiver types. When exported it can only be further restricted in addition to the default accepts implementation.
for ways how to dispatch libraries.