Class NullCallSite
java.lang.Object
org.codehaus.groovy.runtime.callsite.AbstractCallSite
org.codehaus.groovy.runtime.callsite.NullCallSite
- All Implemented Interfaces:
CallSite
Call site that sends a
null receiver to NullObject
before the default call or property read. A non-null receiver is passed through unchanged.-
Field Summary
Fields inherited from class org.codehaus.groovy.runtime.callsite.AbstractCallSite
array, index, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetProperty(Object receiver) Whenreceiverisnull, readsnamefromNullObject.getNullObject()throughInvokerHelper.getProperty(Object, String).Methods inherited from class org.codehaus.groovy.runtime.callsite.AbstractCallSite
acceptGetProperty, acceptGroovyObjectGetProperty, call, call, call, call, call, callConstructor, callConstructor, callConstructor, callConstructor, callConstructor, callConstructor, callCurrent, callCurrent, callCurrent, callCurrent, callCurrent, callCurrent, callGetProperty, callGetPropertySafe, callGroovyObjectGetProperty, callGroovyObjectGetPropertySafe, callSafe, callSafe, callSafe, callSafe, callSafe, callSafe, callStatic, callStatic, callStatic, callStatic, callStatic, callStatic, createGetPropertySite, createGroovyObjectGetPropertySite, getArray, getIndex, getName
-
Constructor Details
-
NullCallSite
Copies the call metadata fromcallSite.- Parameters:
callSite- the site whose name and index are reused
-
-
Method Details
-
call
Whenreceiverisnull, dispatches throughNullObject.getNullObject(). Otherwise forwardsreceiverunchanged. AGroovyRuntimeExceptionfrom the null path is rethrown viaScriptBytecodeAdapter.unwrap(GroovyRuntimeException).- Specified by:
callin interfaceCallSite- Overrides:
callin classAbstractCallSite- Parameters:
receiver- the call receiver, possiblynullargs- the call arguments- Returns:
- the call result
- Throws:
Throwable- when the call fails
-
getProperty
Whenreceiverisnull, readsnamefromNullObject.getNullObject()throughInvokerHelper.getProperty(Object, String). Otherwise selects a property site withAbstractCallSite.acceptGetProperty(Object)and reads fromreceiver. AGroovyRuntimeExceptionfrom the null path is rethrown viaScriptBytecodeAdapter.unwrap(GroovyRuntimeException).- Specified by:
getPropertyin interfaceCallSite- Overrides:
getPropertyin classAbstractCallSite- Parameters:
receiver- the property owner, possiblynull- Returns:
- the property value
- Throws:
Throwable- when the read fails
-