public class CallableSelector
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static interface |
CallableSelector.CallableAcceptor |
private static interface |
CallableSelector.Matcher |
| Modifier and Type | Field and Description |
|---|---|
private static CallableSelector.Matcher |
ASSIGNABLE |
private static CallableSelector.CallableAcceptor |
AssignableAndPrimitivable |
private static CallableSelector.CallableAcceptor |
AssignableAndPrimitivableWithVarargs |
private static CallableSelector.CallableAcceptor |
AssignableOrDuckable |
private static CallableSelector.Matcher |
DUCKABLE |
private static CallableSelector.CallableAcceptor |
Exact |
private static CallableSelector.Matcher |
EXACT |
private static CallableSelector.Matcher |
PRIMITIVABLE |
| Modifier | Constructor and Description |
|---|---|
private |
CallableSelector() |
| Modifier and Type | Method and Description |
|---|---|
private static int |
argsHashCode(IRubyObject a0) |
private static int |
argsHashCode(IRubyObject[] args) |
private static int |
argsHashCode(IRubyObject a0,
IRubyObject a1) |
private static int |
argsHashCode(IRubyObject a0,
IRubyObject a1,
IRubyObject a2) |
private static int |
argsHashCode(IRubyObject a0,
IRubyObject a1,
IRubyObject a2,
IRubyObject a3) |
private static boolean |
assignable(java.lang.Class<?> type,
IRubyObject arg) |
private static boolean |
assignableAndPrimitivable(ParameterTypes paramTypes,
IRubyObject... args) |
private static boolean |
assignableAndPrimitivableWithVarargs(ParameterTypes paramTypes,
IRubyObject... args) |
private static boolean |
assignableOrDuckable(ParameterTypes paramTypes,
IRubyObject... args) |
private static int |
calcExactnessScore(ParameterTypes callable,
IRubyObject[] args) |
private static int |
calcTypePreference(java.lang.Class<?> type,
IRubyObject arg) |
private static boolean |
duckable(java.lang.Class<?> type,
IRubyObject arg) |
private static boolean |
exactMatch(ParameterTypes paramTypes,
IRubyObject... args) |
private static <T extends ParameterTypes> |
findCallable(T[] callables,
CallableSelector.CallableAcceptor acceptor,
IRubyObject[] args) |
private static <T extends ParameterTypes> |
findCallableCandidates(T[] callables,
IRubyObject[] args) |
private static <T extends ParameterTypes> |
findMatchingCallableForArgs(Ruby runtime,
T[] methods,
IRubyObject... args) |
private static <T extends ParameterTypes> |
findMatchingCallableForArgsFallback(Ruby runtime,
T[] methods,
IRubyObject... args) |
private static java.lang.Class<?> |
getJavaClass(IRubyObject arg) |
private static int |
javaClassHashCode(IRubyObject arg) |
private static int |
javaClassOrProcHashCode(IRubyObject arg) |
static <T extends ParameterTypes> |
matchingCallableArityFour(Ruby runtime,
IntHashMap<T> cache,
T[] methods,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3) |
static JavaCallable |
matchingCallableArityFour(Ruby runtime,
java.util.Map cache,
JavaCallable[] methods,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3) |
static <T extends ParameterTypes> |
matchingCallableArityN(Ruby runtime,
IntHashMap<T> cache,
T[] methods,
IRubyObject[] args) |
static JavaCallable |
matchingCallableArityN(Ruby runtime,
java.util.Map cache,
JavaCallable[] methods,
IRubyObject[] args) |
static ParameterTypes |
matchingCallableArityN(Ruby runtime,
java.util.Map cache,
ParameterTypes[] methods,
IRubyObject[] args) |
static <T extends ParameterTypes> |
matchingCallableArityOne(Ruby runtime,
IntHashMap<T> cache,
T[] methods,
IRubyObject arg0) |
static JavaCallable |
matchingCallableArityOne(Ruby runtime,
java.util.Map cache,
JavaCallable[] methods,
IRubyObject arg0) |
static <T extends ParameterTypes> |
matchingCallableArityThree(Ruby runtime,
IntHashMap<T> cache,
T[] methods,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2) |
static JavaCallable |
matchingCallableArityThree(Ruby runtime,
java.util.Map cache,
JavaCallable[] methods,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2) |
static <T extends ParameterTypes> |
matchingCallableArityTwo(Ruby runtime,
IntHashMap<T> cache,
T[] methods,
IRubyObject arg0,
IRubyObject arg1) |
static JavaCallable |
matchingCallableArityTwo(Ruby runtime,
java.util.Map cache,
JavaCallable[] methods,
IRubyObject arg0,
IRubyObject arg1) |
static <T extends ParameterTypes> |
newCallableCache()
Internal helper to allocate a callable map to cache argument method matches.
|
private static boolean |
primitivable(java.lang.Class<?> type,
IRubyObject arg)
This method checks whether an argument can be *directly* converted into
the target primitive, i.e.
|
private static final CallableSelector.CallableAcceptor Exact
private static final CallableSelector.CallableAcceptor AssignableAndPrimitivable
private static final CallableSelector.CallableAcceptor AssignableOrDuckable
private static final CallableSelector.CallableAcceptor AssignableAndPrimitivableWithVarargs
private static final CallableSelector.Matcher EXACT
private static final CallableSelector.Matcher ASSIGNABLE
private static final CallableSelector.Matcher PRIMITIVABLE
private static final CallableSelector.Matcher DUCKABLE
public static ParameterTypes matchingCallableArityN(Ruby runtime, java.util.Map cache, ParameterTypes[] methods, IRubyObject[] args)
public static JavaCallable matchingCallableArityN(Ruby runtime, java.util.Map cache, JavaCallable[] methods, IRubyObject[] args)
public static JavaCallable matchingCallableArityOne(Ruby runtime, java.util.Map cache, JavaCallable[] methods, IRubyObject arg0)
public static JavaCallable matchingCallableArityTwo(Ruby runtime, java.util.Map cache, JavaCallable[] methods, IRubyObject arg0, IRubyObject arg1)
public static JavaCallable matchingCallableArityThree(Ruby runtime, java.util.Map cache, JavaCallable[] methods, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
public static JavaCallable matchingCallableArityFour(Ruby runtime, java.util.Map cache, JavaCallable[] methods, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
public static <T extends ParameterTypes> T matchingCallableArityN(Ruby runtime, IntHashMap<T> cache, T[] methods, IRubyObject[] args)
public static <T extends ParameterTypes> T matchingCallableArityOne(Ruby runtime, IntHashMap<T> cache, T[] methods, IRubyObject arg0)
public static <T extends ParameterTypes> T matchingCallableArityTwo(Ruby runtime, IntHashMap<T> cache, T[] methods, IRubyObject arg0, IRubyObject arg1)
public static <T extends ParameterTypes> T matchingCallableArityThree(Ruby runtime, IntHashMap<T> cache, T[] methods, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
public static <T extends ParameterTypes> T matchingCallableArityFour(Ruby runtime, IntHashMap<T> cache, T[] methods, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
private static <T extends ParameterTypes> T findMatchingCallableForArgs(Ruby runtime, T[] methods, IRubyObject... args)
private static <T extends ParameterTypes> T findMatchingCallableForArgsFallback(Ruby runtime, T[] methods, IRubyObject... args)
private static <T extends ParameterTypes> T findCallable(T[] callables, CallableSelector.CallableAcceptor acceptor, IRubyObject[] args)
private static <T extends ParameterTypes> java.util.List<T> findCallableCandidates(T[] callables, IRubyObject[] args)
private static int calcExactnessScore(ParameterTypes callable, IRubyObject[] args)
private static boolean exactMatch(ParameterTypes paramTypes, IRubyObject... args)
private static boolean assignableAndPrimitivable(ParameterTypes paramTypes, IRubyObject... args)
private static boolean assignableOrDuckable(ParameterTypes paramTypes, IRubyObject... args)
private static boolean assignableAndPrimitivableWithVarargs(ParameterTypes paramTypes, IRubyObject... args)
private static boolean assignable(java.lang.Class<?> type,
IRubyObject arg)
private static boolean primitivable(java.lang.Class<?> type,
IRubyObject arg)
type - The target typearg - The argument to convertprivate static int calcTypePreference(java.lang.Class<?> type,
IRubyObject arg)
private static boolean duckable(java.lang.Class<?> type,
IRubyObject arg)
private static int argsHashCode(IRubyObject a0)
private static int argsHashCode(IRubyObject a0, IRubyObject a1)
private static int argsHashCode(IRubyObject a0, IRubyObject a1, IRubyObject a2)
private static int argsHashCode(IRubyObject a0, IRubyObject a1, IRubyObject a2, IRubyObject a3)
private static int argsHashCode(IRubyObject[] args)
private static int javaClassHashCode(IRubyObject arg)
private static int javaClassOrProcHashCode(IRubyObject arg)
private static java.lang.Class<?> getJavaClass(IRubyObject arg)
public static <T extends ParameterTypes> IntHashMap<T> newCallableCache()
T - the callable typeCallableSelector