Top Inners Fields Constructors Methods
org.jruby.java.invokers

public abstract Class RubyToJavaInvoker<T extends JavaCallable>

extends JavaMethod
Class Inheritance
Known Direct Subclasses
org.jruby.java.invokers.ConstructorInvoker, org.jruby.java.invokers.MethodInvoker
Imports
java.lang.reflect.AccessibleObject, .Array, .Member, .Method, .Modifier, java.util.ArrayList, java.util.function.Supplier, org.jruby.Ruby, .RubyModule, org.jruby.exceptions.RaiseException, org.jruby.internal.runtime.methods.JavaMethod, org.jruby.java.dispatch.CallableSelector, org.jruby.java.proxies.ArrayJavaProxy, .ConcreteJavaProxy, .JavaProxy, org.jruby.javasupport.Java, .JavaCallable, .JavaConstructor, .ParameterTypes, org.jruby.runtime.Arity, .Signature, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.cli.Options, org.jruby.util.collections.IntHashMap, .NonBlockingHashMapLong

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv NonBlockingHashMapLong<T>
pack-priv volatile boolean
protected T
protected T[][]
protected T[]
private final Supplier<Member[]>
pack-priv static final NonBlockingHashMapLong<TypeV>
private final Ruby
Inherited from org.jruby.internal.runtime.methods.JavaMethod:
BLOCK_METHODSBLOCK_REST_METHODSMETHODSNAME_PASSERnativeCallRESTREST_METHODSsignaturestaticScope

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static JavaProxy
private void
checkCallableArity(final T callable, final int expected)

public static Object[]
convertArguments(final ParameterTypes method, final IRubyObject[] args)

public static Object[]
convertArguments(final ParameterTypes method, final IRubyObject[] args, final int addSpace)

public static Object[]
convertArguments(final ParameterTypes method, final IRubyObject arg0, final int addSpace)

private static <T> Object
convertVarArgumentsOnly(final Class<T> varArrayType, final int varStart, final IRubyObject[] args)

private static Object
convertVarArgumentsOnly(final Class<?> varArrayType, final IRubyObject arg0)

protected abstract T
createCallable(Ruby runtime, Member member)

protected abstract T[]
createCallableArray(T callable)

protected abstract T[]
protected abstract T[][]
public T

Returns:

a suitable callable, or else raises an argument or name error
findCallable
(IRubyObject
the proxy wrapper
self
,
String
the method name
name
,
IRubyObject[]
the arguments
args
,
final int
the actual arity
arity
)

Find the matching callable object given the target proxy wrapper, method name, arguments, and actual arity.

protected final T
private T
findCallableArityN(IRubyObject self, String name, IRubyObject[] args, int arity)

protected final T
protected final T
protected final T
protected final T
private static String
private static Class<?>
getClass(final IRubyObject object)

pack-priv final int
protected abstract Class<T>[]
public final T

Returns:

callable
getSignature
(int signatureCode)

Internal API

pack-priv void
private boolean
protected abstract boolean
isMemberVarArgs(Member member)
Deprecated

private T
private T
private T
private T
private T
private T
pack-priv RaiseException
newErrorDueArgumentTypeMismatch(final IRubyObject receiver, final T[] methods, IRubyObject... args)

private RaiseException
newErrorDueNoMatchingCallable(final IRubyObject receiver, final String name)

public final void
putSignature(int signatureCode, T callable)

Internal API

private static void
pack-priv static <T extends AccessibleObject & Member> T
setAccessible(T accessible)

pack-priv static <T extends AccessibleObject & Member> T[]
setAccessible(T[] accessibles)

private boolean
private void
setSignature(final int minArity, final int maxArity, final int minVarArgsArity)

pack-priv final void
private T
pack-priv static Object
Inherited from org.jruby.internal.runtime.methods.JavaMethod:
callTracecallTraceCompiledcheckArgumentCountdupgetAritygetCallerRequirementgetJavaNamegetNativeCallgetParameterListgetSignaturegetStaticScopeisNativeisSingletonpostBacktraceAndScopepostBacktraceDummyScopepostBacktraceOnlypostFrameAndScopepostFrameOnlypostNoFrameDummyScopepostNooppostScopeOnlypreBacktraceAndScopepreBacktraceDummyScopepreBacktraceOnlypreFrameAndDummyScopepreFrameAndDummyScopepreFrameAndScopepreFrameAndScopepreFrameOnlypreFrameOnlypreNoFrameDummyScopepreNooppreScopeOnlyraiseArgumentErrorreturnTracereturnTraceCompiledsetAritysetCallerRequirementsetJavaNamesetNativeCallsetNativeCallsetParameterDescsetParameterListsetSignaturesetSingleton

Field Detail

cacheback to summary
pack-priv NonBlockingHashMapLong<T> cache
initializedback to summary
pack-priv volatile boolean initialized
javaCallableback to summary
protected T javaCallable
javaCallablesback to summary
protected T[][] javaCallables
javaVarargsCallablesback to summary
protected T[] javaVarargsCallables
membersback to summary
private final Supplier<Member[]> members
NULL_CACHEback to summary
pack-priv static final NonBlockingHashMapLong<TypeV> NULL_CACHE
runtimeback to summary
private final Ruby runtime

Constructor Detail

RubyToJavaInvokerback to summary
pack-priv RubyToJavaInvoker(RubyModule host, Supplier<Member[]> members, String name)
Annotations
@SuppressWarnings:unchecked

Method Detail

castJavaProxyback to summary
pack-priv static JavaProxy castJavaProxy(final IRubyObject self)
checkCallableArityback to summary
private void checkCallableArity(final T callable, final int expected)
convertArgumentsback to summary
public static Object[] convertArguments(final ParameterTypes method, final IRubyObject[] args)
convertArgumentsback to summary
public static Object[] convertArguments(final ParameterTypes method, final IRubyObject[] args, final int addSpace)
convertArgumentsback to summary
public static Object[] convertArguments(final ParameterTypes method, final IRubyObject arg0, final int addSpace)
convertVarArgumentsOnlyback to summary
private static <T> Object convertVarArgumentsOnly(final Class<T> varArrayType, final int varStart, final IRubyObject[] args)
Annotations
@SuppressWarnings:unchecked
convertVarArgumentsOnlyback to summary
private static Object convertVarArgumentsOnly(final Class<?> varArrayType, final IRubyObject arg0)
createCallableback to summary
protected abstract T createCallable(Ruby runtime, Member member)
createCallableArrayback to summary
protected abstract T[] createCallableArray(T callable)
createCallableArrayback to summary
protected abstract T[] createCallableArray(int size)
createCallableArrayArrayback to summary
protected abstract T[][] createCallableArrayArray(int size)
findCallableback to summary
public T findCallable(IRubyObject self, String name, IRubyObject[] args, final int arity)

Find the matching callable object given the target proxy wrapper, method name, arguments, and actual arity.

Parameters
self:IRubyObject

the proxy wrapper

name:String

the method name

args:IRubyObject[]

the arguments

arity:int

the actual arity

Returns:T

a suitable callable, or else raises an argument or name error

findCallableArityFourback to summary
protected final T findCallableArityFour(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
findCallableArityNback to summary
private T findCallableArityN(IRubyObject self, String name, IRubyObject[] args, int arity)
findCallableArityOneback to summary
protected final T findCallableArityOne(IRubyObject self, String name, IRubyObject arg0)
findCallableArityThreeback to summary
protected final T findCallableArityThree(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
findCallableArityTwoback to summary
protected final T findCallableArityTwo(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1)
findCallableArityZeroback to summary
protected final T findCallableArityZero(IRubyObject self, String name)
formatReceiverback to summary
private static String formatReceiver(final IRubyObject object)
getClassback to summary
private static Class<?> getClass(final IRubyObject object)
getMemberArityback to summary
pack-priv final int getMemberArity(Member member)
getMemberParameterTypesback to summary
protected abstract Class<T>[] getMemberParameterTypes(Member member)
getSignatureback to summary
public final T getSignature(int signatureCode)

Internal API

Returns:T

callable

initializeback to summary
pack-priv void initialize()
isConstructorback to summary
private boolean isConstructor()
isMemberVarArgsback to summary
protected abstract boolean isMemberVarArgs(Member member)

Deprecated

Annotations
@Deprecated
matchVarArgsCallableArityFourback to summary
private T matchVarArgsCallableArityFour(IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
matchVarArgsCallableArityNback to summary
private T matchVarArgsCallableArityN(IRubyObject self, IRubyObject[] args)
matchVarArgsCallableArityOneback to summary
private T matchVarArgsCallableArityOne(IRubyObject self, IRubyObject arg0)
matchVarArgsCallableArityThreeback to summary
private T matchVarArgsCallableArityThree(IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
matchVarArgsCallableArityTwoback to summary
private T matchVarArgsCallableArityTwo(IRubyObject self, IRubyObject arg0, IRubyObject arg1)
matchVarArgsCallableArityZeroback to summary
private T matchVarArgsCallableArityZero(IRubyObject self)
newErrorDueArgumentTypeMismatchback to summary
pack-priv RaiseException newErrorDueArgumentTypeMismatch(final IRubyObject receiver, final T[] methods, IRubyObject... args)
newErrorDueNoMatchingCallableback to summary
private RaiseException newErrorDueNoMatchingCallable(final IRubyObject receiver, final String name)
putSignatureback to summary
public final void putSignature(int signatureCode, T callable)

Internal API

rethrowIfNotInaccessibleObjectback to summary
private static void rethrowIfNotInaccessibleObject(RuntimeException re)
setAccessibleback to summary
pack-priv static <T extends AccessibleObject & Member> T setAccessible(T accessible)
setAccessibleback to summary
pack-priv static <T extends AccessibleObject & Member> T[] setAccessible(T[] accessibles)
setNativeCallIfPublicback to summary
private boolean setNativeCallIfPublic(final Method method)
setSignatureback to summary
private void setSignature(final int minArity, final int maxArity, final int minVarArgsArity)
setupNativeCallback to summary
pack-priv final void setupNativeCall()
someCallableback to summary
private T someCallable()
unwrapIfJavaProxyback to summary
pack-priv static Object unwrapIfJavaProxy(final IRubyObject object)
org.jruby.java.invokers back to summary

private Class RubyToJavaInvoker.NullHashMapLong<V>

extends NonBlockingHashMapLong<V>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public V
get(Object
the key whose associated value is to be returned
key
)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.get.

Implements java.util.Map.get.

Auto-boxing version of get(long).

public V
put(long
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
val
)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.put.

Implements java.util.Map.put.

Maps the specified key to the specified value in the table.

public V
putIfAbsent(long
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
val
)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.putIfAbsent.

Overrides default java.util.Map.putIfAbsent.

Implements java.util.concurrent.ConcurrentMap.putIfAbsent.

Atomically, do a put if-and-only-if the key is not mapped.

Inherited from org.jruby.util.collections.NonBlockingHashMapLong:
clearcontainscontainsKeycontainsKeycontainsValueelementsentrySetgetkeyskeySetputputIfAbsentremoveremoveremoveremovereplacereplacereplacereplacereprobessizevalues

Constructor Detail

NullHashMapLongback to summary
pack-priv NullHashMapLong()

Method Detail

getback to summary
public V get(Object key)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.get.

Implements java.util.Map.get.

Doc from org.jruby.util.collections.NonBlockingHashMapLong.get.

Auto-boxing version of get(long).

Parameters
key:Object

Doc from java.util.Map.get.

the key whose associated value is to be returned

Returns:V

Doc from java.util.Map.get.

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
putback to summary
public V put(long key, V val)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.put.

Implements java.util.Map.put.

Doc from org.jruby.util.collections.NonBlockingHashMapLong.put.

Maps the specified key to the specified value in the table. The value cannot be null.

The value can be retrieved by calling get with a key that is equal to the original key.

Parameters
key:long

key with which the specified value is to be associated

val:V

value to be associated with the specified key

Returns:V

the previous value associated with key, or null if there was no mapping for key

Annotations
@Override
putIfAbsentback to summary
public V putIfAbsent(long key, V val)

Overrides org.jruby.util.collections.NonBlockingHashMapLong.putIfAbsent.

Overrides default java.util.Map.putIfAbsent.

Implements java.util.concurrent.ConcurrentMap.putIfAbsent.

Doc from org.jruby.util.collections.NonBlockingHashMapLong.putIfAbsent.

Atomically, do a put if-and-only-if the key is not mapped. Useful to ensure that only a single mapping for the key exists, even if many threads are trying to create the mapping in parallel.

Parameters
key:long

Doc from java.util.concurrent.ConcurrentMap.putIfAbsent.

key with which the specified value is to be associated

val:V

Doc from java.util.concurrent.ConcurrentMap.putIfAbsent.

value to be associated with the specified key

Returns:V

the previous value associated with the specified key, or null if there was no mapping for the key

Annotations
@Override