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

public Class JavaProxy

extends RubyObject
Class Inheritance
Known Direct Subclasses
org.jruby.java.proxies.ArrayJavaProxy, org.jruby.java.proxies.ConcreteJavaProxy, org.jruby.java.proxies.InterfaceJavaProxy
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .ObjectOutputStream, .Serializable, java.lang.reflect.Array, .Constructor, .Field, .Method, .Modifier, java.text.MessageFormat, java.util.Arrays, .HashMap, .Iterator, .Map, java.util.function.Predicate, org.jruby.AbstractRubyMethod, .Ruby, .RubyArray, .RubyBasicObject, .RubyClass, .RubyHash, .RubyMethod, .RubyModule, .RubyObject, .RubyUnboundMethod, org.jruby.anno.JRubyMethod, org.jruby.api.Access, .Convert, org.jruby.common.IRubyWarnings, org.jruby.exceptions.RaiseException, org.jruby.java.invokers.ConstructorInvoker, .InstanceFieldGetter, .InstanceFieldSetter, .InstanceMethodInvoker, .MethodInvoker, .RubyToJavaInvoker, .StaticFieldGetter, .StaticFieldSetter, .StaticMethodInvoker, org.jruby.java.util.ClassUtils, org.jruby.javasupport.Java, .JavaMethod, .JavaUtil, org.jruby.javasupport.binding.MethodGatherer, org.jruby.runtime.Arity, .Helpers, .Block, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, .InternalVariables, org.jruby.runtime.callsite.CacheEntry, org.jruby.util.ByteList, .CodegenUtils, .JRubyObjectInputStream

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static final RubyHash.VisitorWithState<Map<K, V>>
private static final String
private static final String
pack-priv Object
Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
public
JavaProxy(Ruby runtime, RubyClass klazz)

public
JavaProxy(Ruby runtime, RubyClass klazz, Object object)

Method Summary

Modifier and TypeMethod and Description
protected JavaObject
asJavaObject(final Object object)
Deprecated

private static void
checkArgSizeMismatch(final Ruby runtime, final int expected, final RubyArray<T extends IRubyObject> argTypes)

public void
protected Object
private void
public static RubyClass
createJavaProxy(ThreadContext context, RubyClass Object, RubyModule JavaProxyMethods)

public final Object
public final void
dataWrapStruct(Object
the object to wrap
object
)

Overrides org.jruby.RubyBasicObject.dataWrapStruct.

Implements org.jruby.runtime.builtin.IRubyObject.dataWrapStruct.

Our version of Data_Wrap_Struct.

public IRubyObject
equal_p(ThreadContext
the thread context
context
,
IRubyObject
to compare with
other
)

Overrides org.jruby.RubyBasicObject.equal_p.

rb_obj_equal Will use Java identity equality.

public static IRubyObject
public static IRubyObject
public static IRubyObject
private static void
findFields(final ThreadContext context, final RubyModule topModule, final IRubyObject[] args, final boolean asReader, final boolean asWriter)

private static Map<String, String>
getFieldListFromArgs(ThreadContext context, IRubyObject[] args)

Create a name/newname map of fields to be exposed as methods.

public static IRubyObject

Returns:

a java.lang.Class instance proxy (e.g. a java.lang.Integer.class wrapper)
getJavaClass
(final RubyModule
(Java) proxy module/class
target
)

public Class<?>
getJavaClass()

Overrides org.jruby.RubyBasicObject.getJavaClass.

Implements org.jruby.runtime.builtin.IRubyObject.getJavaClass.

Will return the Java interface that most closely can represent this object, when working through Java integration translations.

private Method
getMethod(ThreadContext context, String name, Class<T>... argTypes)

private MethodInvoker
public final Object
private RubyMethod
getRubyMethod(ThreadContext context, String name, Class<T>... argTypes)

public Object
public static IRubyObject
public IRubyObject
initialize_copy(ThreadContext
the thread context
context
,
IRubyObject
the original
original
)

Overrides org.jruby.RubyBasicObject.initialize_copy.

Initializes this object as a copy of the original, that is the parameter to this object.

protected int

Returns:

The identity hashcode of the wrapped object
inspectHashCode
()

Overrides org.jruby.RubyBasicObject.inspectHashCode.

We override RubyBasicObject.inspectHashCode to be the identity hash of the contained object, so it remains consistent across wrappers.

private static void
installField(final ThreadContext context, final Map<String, String> fieldMap, final Field field, final RubyModule module, boolean asReader, boolean asWriter)

private static void
installField(final ThreadContext context, final String asName, final Field field, final RubyModule target, boolean asReader, Boolean asWriter)

public static void
installField(final ThreadContext context, final String asName, final Field field, final RubyModule target)

public static IRubyObject
java_class(final IRubyObject self)

public IRubyObject
public IRubyObject
java_method(ThreadContext context, IRubyObject rubyName, IRubyObject argTypes)

public IRubyObject
java_send(ThreadContext context, IRubyObject rubyName)

public IRubyObject
java_send(ThreadContext context, IRubyObject rubyName, IRubyObject argTypes)

public IRubyObject
java_send(ThreadContext context, IRubyObject rubyName, IRubyObject argTypes, IRubyObject arg0)

public IRubyObject
public IRubyObject
marshal_dump()
Deprecated since 10.0.

public IRubyObject
public IRubyObject
marshal_load(final ThreadContext context, final IRubyObject str)

public static IRubyObject
public static IRubyObject
public static IRubyObject
persistent(final IRubyObject clazz, final IRubyObject value)

public static IRubyObject
persistent(final ThreadContext context, final IRubyObject clazz)

public static void
setJavaClass(final RubyClass target, final Class<?> javaClass)

public static void
setJavaClass(final IRubyObject target, final Class<?> javaClass)
Deprecated since 10.0.

public static void
setJavaClass(ThreadContext context, final IRubyObject target, final Class<?> javaClass)

pack-priv static void
setJavaClass(final Ruby runtime, final InternalVariables target, final Class<?> javaClass)

private static void
setJavaClass(final InternalVariables target, final IRubyObject javaClass)

public void
setObject(Object object)

public void
public static RubyClass
singleton_class(final IRubyObject self)
Deprecated since 10.0.

public static RubyClass
public RubyClass
singletonClass(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.singletonClass.

Overrides default org.jruby.runtime.builtin.IRubyObject.singletonClass.

rb_singleton_class Note: this method is specialized for RubyFixnum, RubySymbol, RubyNil and RubyBoolean Will either return the existing singleton class for this object, or create a new one and return that.

public <T> T
toJava(Class<T>
The target type to which the object should be converted.
type
)

Overrides org.jruby.RubyBasicObject.toJava.

Implements org.jruby.runtime.builtin.IRubyObject.toJava.

Convert the object to the specified Java class, if possible.

private static RaiseException
undefinedFieldError(ThreadContext context, String javaClassName, String name)

public Object
public static IRubyObject
wrap(final ThreadContext context, final IRubyObject self, final IRubyObject object)
Deprecated

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalequalsfinishObjectClassgetNativeClassIndexhashCodeinspectop_eqqputsspecificEvaltoRubyStringtoString