Class Library
- All Implemented Interfaces:
NodeInterface, Cloneable
- Direct Known Subclasses:
DynamicDispatchLibrary, DynamicObjectLibrary, InteropLibrary, NodeLibrary, ReflectionLibrary
GenerateLibrary. Implementations for the abstract methods specified in this classes are
not supposed to be implemented manually.- Since:
- 19.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Node
Node.Child, Node.Children -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Constructor Details
-
Library
protected Library()Default constructor for sub-classes. Libraries always have a no-arg protected constructor.- Since:
- 19.0
-
-
Method Details
-
accepts
Returnstrueif this library instance supports sending messages with the given receiver. If accepts returnsfalseand a library message is sent anyway then anAssertionErroris thrown if assertions are enabled (-ea). Otherwise aNullPointerExceptionorClassCastExceptionmay 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 returnfalse. 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 returntruefor 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
CachedLibraryshould be used instead. For slow-paths theinternally dispatchedversions 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.
- Since:
- 19.0
- See Also:
-