java::lang::ObjectRef Class Reference

Inheritance diagram for java::lang::ObjectRef:

Inheritance graph
java::lang::Ref\< Type \>java::lang::Ref\< java::awt::Adjustable \>java::lang::Ref\< java::awt::CheckboxGroup \>java::lang::Ref\< java::awt::Component \>java::lang::Ref\< java::awt::Container \>java::lang::Ref\< java::awt::Graphics \>java::lang::Ref\< java::awt::image::ImageConsumer \>java::lang::Ref\< java::awt::ItemCheckable \>java::lang::Ref\< java::awt::Window \>java::lang::Ref\< java::io::Charset \>java::lang::Ref\< java::io::CodingErrorAction \>java::lang::Ref\< java::io::FileDescriptor \>java::lang::Ref\< java::io::InputStream \>java::lang::Ref\< java::io::OutputStream \>java::lang::Ref\< java::io::PrintStream \>java::lang::Ref\< java::io::Properties \>java::lang::Ref\< java::io::Reader \>java::lang::Ref\< java::io::Writer \>java::lang::Ref\< java::lang::Array\< char \> \>java::lang::Ref\< java::lang::Exception \>java::lang::Ref\< java::lang::Runnable \>java::lang::Ref\< java::lang::ScopeAdapter \>java::lang::Ref\< java::lang::Sync \>java::lang::Ref\< java::lang::Throwable \>java::lang::Ref\< java::net::InetAddress \>java::lang::Ref\< java::net::SocketImpl \>java::lang::Ref\< java::net::SocketImplFactory \>java::lang::Ref\< java::util::EventListener \>java::lang::Ref\< java::util::List \>java::lang::Ref\< java::util::SortedMap \>java::lang::Ref\< java::util::TimeZone \>java::lang::Comparablejava::lang::Interfacejava::lang::Object
[legend]
Collaboration diagram for java::lang::ObjectRef:

Collaboration graph
java::lang::Comparablejava::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

Class ObjectRef is the pointer reference of the object.

1. Return a reference from the system hashtable: Type& method(); 2. Return a new instance or abstract class reference: Ref<Type> method() or JObjectRef method() 3. Return an concret object instance copy from a method: Type method();

For object reference use const JObject& as parameters For object instence to be keep by host or polymorph objects use const JObjectRef& as parameters

When ObjectRef return from a method, please save it into local ObjectRef or Ref<Type> variable first. Then use it in local scope. if use castof and directly save into a Type& the instance will be released by ObjectRef before assignment and no longer valid thereafter.

jbyte cast to jchar may has problem on high byte. use jchar c = b & 0xFF instead.

jint assign or append to JArray or JBuffer are fine but assign or append to JString should cast to (jchar) JString interrupt jint and jchar or jbyte differently.

Author:
Yuh-Jye Chang
Version:
1.0, 06/11/02

Public Member Functions

 ObjectRef ()
 ObjectRef (const Object *src)
 ObjectRef (const Object &src)
 ObjectRef (const ObjectRef &src)
ObjectRefoperator= (const Object *src)
ObjectRefoperator= (const Object &src)
ObjectRefoperator= (const ObjectRef &src)
jboolean operator== (const Object *ptr) const
jboolean operator== (const Object &obj) const
jboolean operator!= (const Object *ptr) const
jboolean operator!= (const Object &obj) const
Objectoperator-> () const
Objectoperator * () const
virtual ~ObjectRef ()
virtual jboolean equals (const Object &) const
 Indicates whether some other object is "equal to" this one.
virtual jboolean equals (const ObjectRef &) const
virtual jint hashCode () const
 Returns a hash code value for the object.
virtual String toString () const
 Returns a string representation of the object.
virtual jint compareTo (const Object &) const
 Compares this object with the specified object for order.
virtual jint compareTo (const ObjectRef &) const
ObjectRef set (const ObjectRef &src=0)
 Replace the current object reference with the new object reference.
jboolean dup ()
 If the object reference is weak or its strong and have more then one reference, duplicate this object and decrease its refernce counter.
jboolean weaken ()
 If the object reference is strong, make it a weak reference and decrease its refernece counter.

Protected Attributes

Objectvalue

Constructor & Destructor Documentation

java::lang::ObjectRef::ObjectRef (  )  [inline]

java::lang::ObjectRef::ObjectRef ( const Object src  )  [inline]

java::lang::ObjectRef::ObjectRef ( const Object src  )  [inline]

java::lang::ObjectRef::ObjectRef ( const ObjectRef src  )  [inline]

virtual java::lang::ObjectRef::~ObjectRef (  )  [inline, virtual]


Member Function Documentation

ObjectRef& java::lang::ObjectRef::operator= ( const Object src  )  [inline]

ObjectRef& java::lang::ObjectRef::operator= ( const Object src  )  [inline]

ObjectRef& java::lang::ObjectRef::operator= ( const ObjectRef src  )  [inline]

Reimplemented in java::lang::Ref< Type >, java::lang::Ref< java::awt::ItemCheckable >, java::lang::Ref< java::io::InputStream >, java::lang::Ref< java::awt::Graphics >, java::lang::Ref< java::awt::Container >, java::lang::Ref< java::awt::image::ImageConsumer >, java::lang::Ref< java::awt::Window >, java::lang::Ref< java::awt::Component >, java::lang::Ref< java::lang::Exception >, java::lang::Ref< java::awt::CheckboxGroup >, java::lang::Ref< java::io::Writer >, java::lang::Ref< java::io::Properties >, java::lang::Ref< java::io::PrintStream >, java::lang::Ref< java::lang::Throwable >, java::lang::Ref< java::util::List >, java::lang::Ref< java::io::OutputStream >, java::lang::Ref< java::util::EventListener >, java::lang::Ref< java::util::TimeZone >, java::lang::Ref< java::net::SocketImplFactory >, java::lang::Ref< java::net::InetAddress >, java::lang::Ref< java::awt::Adjustable >, java::lang::Ref< java::io::Reader >, java::lang::Ref< java::io::Charset >, java::lang::Ref< java::io::FileDescriptor >, java::lang::Ref< java::io::CodingErrorAction >, java::lang::Ref< java::lang::Array< char > >, java::lang::Ref< java::lang::Sync >, java::lang::Ref< java::lang::Runnable >, java::lang::Ref< java::util::SortedMap >, java::lang::Ref< java::lang::ScopeAdapter >, and java::lang::Ref< java::net::SocketImpl >.

jboolean java::lang::ObjectRef::operator== ( const Object ptr  )  const [inline]

jboolean java::lang::ObjectRef::operator== ( const Object obj  )  const

jboolean java::lang::ObjectRef::operator!= ( const Object ptr  )  const [inline]

jboolean java::lang::ObjectRef::operator!= ( const Object obj  )  const [inline]

Object* java::lang::ObjectRef::operator-> (  )  const [inline]

Reimplemented in java::lang::Ref< Type >, java::lang::Ref< java::awt::ItemCheckable >, java::lang::Ref< java::io::InputStream >, java::lang::Ref< java::awt::Graphics >, java::lang::Ref< java::awt::Container >, java::lang::Ref< java::awt::image::ImageConsumer >, java::lang::Ref< java::awt::Window >, java::lang::Ref< java::awt::Component >, java::lang::Ref< java::lang::Exception >, java::lang::Ref< java::awt::CheckboxGroup >, java::lang::Ref< java::io::Writer >, java::lang::Ref< java::io::Properties >, java::lang::Ref< java::io::PrintStream >, java::lang::Ref< java::lang::Throwable >, java::lang::Ref< java::util::List >, java::lang::Ref< java::io::OutputStream >, java::lang::Ref< java::util::EventListener >, java::lang::Ref< java::util::TimeZone >, java::lang::Ref< java::net::SocketImplFactory >, java::lang::Ref< java::net::InetAddress >, java::lang::Ref< java::awt::Adjustable >, java::lang::Ref< java::io::Reader >, java::lang::Ref< java::io::Charset >, java::lang::Ref< java::io::FileDescriptor >, java::lang::Ref< java::io::CodingErrorAction >, java::lang::Ref< java::lang::Array< char > >, java::lang::Ref< java::lang::Sync >, java::lang::Ref< java::lang::Runnable >, java::lang::Ref< java::util::SortedMap >, java::lang::Ref< java::lang::ScopeAdapter >, and java::lang::Ref< java::net::SocketImpl >.

Object& java::lang::ObjectRef::operator * (  )  const [inline]

Reimplemented in java::lang::Ref< Type >, java::lang::Ref< java::awt::ItemCheckable >, java::lang::Ref< java::io::InputStream >, java::lang::Ref< java::awt::Graphics >, java::lang::Ref< java::awt::Container >, java::lang::Ref< java::awt::image::ImageConsumer >, java::lang::Ref< java::awt::Window >, java::lang::Ref< java::awt::Component >, java::lang::Ref< java::lang::Exception >, java::lang::Ref< java::awt::CheckboxGroup >, java::lang::Ref< java::io::Writer >, java::lang::Ref< java::io::Properties >, java::lang::Ref< java::io::PrintStream >, java::lang::Ref< java::lang::Throwable >, java::lang::Ref< java::util::List >, java::lang::Ref< java::io::OutputStream >, java::lang::Ref< java::util::EventListener >, java::lang::Ref< java::util::TimeZone >, java::lang::Ref< java::net::SocketImplFactory >, java::lang::Ref< java::net::InetAddress >, java::lang::Ref< java::awt::Adjustable >, java::lang::Ref< java::io::Reader >, java::lang::Ref< java::io::Charset >, java::lang::Ref< java::io::FileDescriptor >, java::lang::Ref< java::io::CodingErrorAction >, java::lang::Ref< java::lang::Array< char > >, java::lang::Ref< java::lang::Sync >, java::lang::Ref< java::lang::Runnable >, java::lang::Ref< java::util::SortedMap >, java::lang::Ref< java::lang::ScopeAdapter >, and java::lang::Ref< java::net::SocketImpl >.

virtual jboolean java::lang::ObjectRef::equals ( const Object src  )  const [virtual]

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Parameters:
obj the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

Reimplemented from java::lang::Object.

virtual jboolean java::lang::ObjectRef::equals ( const ObjectRef  )  const [virtual]

virtual jint java::lang::ObjectRef::hashCode (  )  const [inline, virtual]

Returns a hash code value for the object.

This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java<font size="-2">TM</font> programming language.)

Returns:
a hash code value for this object.

Reimplemented from java::lang::Object.

virtual String java::lang::ObjectRef::toString (  )  const [virtual]

Returns a string representation of the object.

In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `</code>', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: <blockquote>

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
</blockquote>

Returns:
a string representation of the object.

Reimplemented from java::lang::Object.

virtual jint java::lang::ObjectRef::compareTo ( const Object src  )  const [virtual]

Compares this object with the specified object for order.

Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Parameters:
src the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Exceptions:
ClassCastException if the specified object's type prevents it from being compared to this Object.

Reimplemented from java::lang::Comparable.

virtual jint java::lang::ObjectRef::compareTo ( const ObjectRef  )  const [virtual]

ObjectRef java::lang::ObjectRef::set ( const ObjectRef src = 0  )  [inline]

Replace the current object reference with the new object reference.

Returns:
the old object reference

jboolean java::lang::ObjectRef::dup (  ) 

If the object reference is weak or its strong and have more then one reference, duplicate this object and decrease its refernce counter.

Then, maintain a strong reference to the new object.

Returns:
true mean object got duplicated.

jboolean java::lang::ObjectRef::weaken (  ) 

If the object reference is strong, make it a weak reference and decrease its refernece counter.

Returns:
true mean object reference got weaken.


Member Data Documentation

Object* java::lang::ObjectRef::value [protected]


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:40 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3