Top Description Fields Constructors Methods
org.jruby.javasupport

public Class JavaObject

extends RubyObject
Class Inheritance
Known Direct Subclasses
org.jruby.javasupport.JavaArray, org.jruby.javasupport.JavaClass
Annotations
@Deprecated
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .ObjectOutputStream, .Serializable, org.jruby.Ruby, .RubyBoolean, .RubyClass, .RubyFixnum, .RubyModule, .RubyObject, .RubyString, org.jruby.runtime.ivars.VariableAccessor, org.jruby.anno.JRubyMethod, org.jruby.java.proxies.JavaProxy, org.jruby.runtime.Block, .ObjectAllocator, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ByteList, .JRubyObjectInputStream

Deprecated

since 9.4

Java::JavaObject wrapping is no longer used with JRuby. The (automatic) Java proxy wrapping has been the preferred method for a while. Just keep using java.lang.Object.new as usual, without the manual JavaObject.wrap java_object.
Author
jpetersen

Field Summary

Modifier and TypeField and Description
private static final ObjectAllocator
private static final Object
private final VariableAccessor
Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
protected
JavaObject(Ruby runtime, RubyClass rubyClass, Object value)

private
JavaObject(Ruby runtime, RubyClass klazz)

Method Summary

Modifier and TypeMethod and Description
public static RubyClass
createJavaObjectClass(Ruby runtime, RubyClass Object, RubyModule javaModule)

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 boolean
equals(final Object
object to compare
other
)

Overrides org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

public IRubyObject
get_java_class()
Deprecated since 10.0.

public IRubyObject
public final 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.

public final Object
public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

public int
hashCode()

Overrides org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

public IRubyObject
is_java_proxy()
Deprecated since 10.0.

public IRubyObject
public JavaClass
java_class()
Deprecated since 9.4-.

public RubyString
java_type()
Deprecated since 10.0.

public RubyString
public RubyFixnum
length()
Deprecated since 10.0.

public RubyFixnum
public IRubyObject
public IRubyObject
public IRubyObject
op_equal(final IRubyObject other)
Deprecated since 10.0.

public IRubyObject
op_equal(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public static RubyBoolean
op_equal(JavaProxy self, IRubyObject other)
Deprecated since 10.0.

public final IRubyObject
public static IRubyObject
ruby_synchronized(ThreadContext context, final Object lock, Block block)

public IRubyObject
same(ThreadContext context, final IRubyObject other)

public IRubyObject
same(final IRubyObject other)
Deprecated

public IRubyObject
public static IRubyObject
to_s(Ruby runtime, Object dataStruct)
Deprecated since 10.0.

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

Overrides org.jruby.RubyBasicObject.toJava.

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

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

public static JavaObject
wrap(final Ruby runtime, final Object value)
Deprecated since 9.4-.

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

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalfinishObjectClassgetNativeClassIndexinspectop_eqqputsspecificEvaltoRubyStringtoString

Field Detail

JAVA_OBJECT_ALLOCATORback to summary
private static final ObjectAllocator JAVA_OBJECT_ALLOCATOR
NULL_LOCKback to summary
private static final Object NULL_LOCK
objectAccessorback to summary
private final VariableAccessor objectAccessor

Constructor Detail

JavaObjectback to summary
protected JavaObject(Ruby runtime, RubyClass rubyClass, Object value)
JavaObjectback to summary
private JavaObject(Ruby runtime, RubyClass klazz)

Method Detail

createJavaObjectClassback to summary
public static RubyClass createJavaObjectClass(Ruby runtime, RubyClass Object, RubyModule javaModule)
dataGetStructback to summary
public final Object dataGetStruct()

Overrides org.jruby.RubyBasicObject.dataGetStruct.

Implements org.jruby.runtime.builtin.IRubyObject.dataGetStruct.

Doc from org.jruby.runtime.builtin.IRubyObject.dataGetStruct.

Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.

Returns:Object

the object wrapped.

Annotations
@Override
dataWrapStructback to summary
public final void dataWrapStruct(Object object)

Overrides org.jruby.RubyBasicObject.dataWrapStruct.

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

Doc from org.jruby.runtime.builtin.IRubyObject.dataWrapStruct.

Our version of Data_Wrap_Struct. This method will just set a private pointer to the object provided. This pointer is transient and will not be accessible from Ruby.

Parameters
object:Object

the object to wrap

Annotations
@Override
equalsback to summary
public boolean equals(final Object other)

Overrides org.jruby.RubyObject.equals.

Doc from org.jruby.RubyObject.equals.

This override does not do a "checked" dispatch.

Parameters
other:Object

Doc from org.jruby.RubyBasicObject.equals.

object to compare

Returns:boolean

Doc from org.jruby.RubyBasicObject.equals.

true if equals

Annotations
@Override
get_java_classback to summary
public IRubyObject get_java_class()

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
get_java_classback to summary
public IRubyObject get_java_class(ThreadContext context)
Annotations
@JRubyMethod
getJavaClassback to summary
public final Class<?> getJavaClass()

Overrides org.jruby.RubyBasicObject.getJavaClass.

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

Doc from org.jruby.RubyBasicObject.getJavaClass.

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

Returns:Class<?>

the true Java class of this (Ruby) object

Annotations
@Override
getValueback to summary
public final Object getValue()
hashback to summary
public RubyFixnum hash(ThreadContext context)

Overrides org.jruby.RubyBasicObject.hash.

Doc from org.jruby.RubyBasicObject.hash.

Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.

Parameters
context:ThreadContext

the current thread context

Returns:RubyFixnum

the hash value

Annotations
@JRubyMethod
hashCodeback to summary
public int hashCode()

Overrides org.jruby.RubyObject.hashCode.

Doc from org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

Returns:int

the hash code

Annotations
@Override
is_java_proxyback to summary
public IRubyObject is_java_proxy()

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
is_java_proxyback to summary
public IRubyObject is_java_proxy(ThreadContext context)
Annotations
@JRubyMethod
name:java_proxy?
java_classback to summary
public JavaClass java_class()

Deprecated

since 9.4-.

Annotations
@Deprecated
since:9.4-
java_typeback to summary
public RubyString java_type()

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
java_typeback to summary
public RubyString java_type(ThreadContext context)
Annotations
@JRubyMethod
lengthback to summary
public RubyFixnum length()

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
lengthback to summary
public RubyFixnum length(ThreadContext context)
Annotations
@JRubyMethod
marshal_dumpback to summary
public IRubyObject marshal_dump(ThreadContext context)
Annotations
@JRubyMethod
marshal_loadback to summary
public IRubyObject marshal_load(ThreadContext context, IRubyObject str)
Annotations
@JRubyMethod
op_equalback to summary
public IRubyObject op_equal(final IRubyObject other)

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
op_equalback to summary
public IRubyObject op_equal(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

Doc from org.jruby.RubyBasicObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems

Annotations
@JRubyMethod
name:==, eql?
op_equalback to summary
public static RubyBoolean op_equal(JavaProxy self, IRubyObject other)

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
ruby_synchronizedback to summary
public final IRubyObject ruby_synchronized(ThreadContext context, Block block)
Annotations
@JRubyMethod
name:synchronized
ruby_synchronizedback to summary
public static IRubyObject ruby_synchronized(ThreadContext context, final Object lock, Block block)
sameback to summary
public IRubyObject same(ThreadContext context, final IRubyObject other)
Annotations
@JRubyMethod
name:equal?
sameback to summary
public IRubyObject same(final IRubyObject other)

Deprecated

Annotations
@Deprecated
to_sback to summary
public IRubyObject to_s(ThreadContext context)

Overrides org.jruby.RubyBasicObject.to_s.

Annotations
@JRubyMethod
@Override
to_sback to summary
public static IRubyObject to_s(Ruby runtime, Object dataStruct)

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
toJavaback to summary
public <T> T toJava(Class<T> target)

Overrides org.jruby.RubyBasicObject.toJava.

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

Doc from org.jruby.runtime.builtin.IRubyObject.toJava.

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

Parameters
<T>
type
target:Class<T>

The target type to which the object should be converted.

Returns:T

java type

Annotations
@Override
@SuppressWarnings:unchecked
wrapback to summary
public static JavaObject wrap(final Ruby runtime, final Object value)

Deprecated

since 9.4-.

Annotations
@Deprecated
since:9.4-
wrapback to summary
public static IRubyObject wrap(final ThreadContext context, final IRubyObject self, final IRubyObject object)
Annotations
@JRubyMethod
meta:true