2005/5/9

     
 

class Class

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::lang::Class Class Reference

#include <Class.h>

Inheritance diagram for acdk::lang::Class:

acdk::lang::Object acdk::lang::dmi::MetaObject acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

A class represents a ACDK Class definition.

The implementation of Class bases on the information generated by the metacompiler acdkmc. Information about member, methods etc. is only available for standard ACDK methods which are not declared as foreign

API: Mainly Java-Spec.

Author:
Roger Rene Kommer (mailto:kommer@artefaktur.com)
Version:
Revision
1.44
Date:
Date
2005/04/09 19:26:48

Bug:
some of the methods regarded security and net are not implemented. Class is based on the underlying ClazzInfo structur, which will be generated by the metacompiler (acdkmc)
See also:
ClazzInfo


Public Member Functions

 Class (const dmi::ClazzInfo *clazzInfo)
 create Class with given clazzInfo

virtual ~Class ()
virtual void finalize ()
 This is for java-compatibility.

virtual dmi::MetaInfogetMetaInfo ()
 internal should be implemented by Class, Method, Member, and so on

void resolve ()
 load full metainfo from my_shared_lib_metainf.so/dll
Exceptions:
exception if full meta info cannot be resolved


RClassLoader getClassLoader ()
 different to Java this method always returns the system class loader.

virtual RClass getComponentType ()
 if this class represends an array it returns the type of the elements of the array, otherwise Nil

::acdk::lang::reflect::RConstructor getDeclaredConstructor (IN(RClassArray) parameterTypes) throw ( RNoSuchMethodException )
 return a constructor with given parameter types
Exceptions:
NoSuchMethodException if no constructor can be found


::acdk::lang::reflect::RConstructorArray getDeclaredConstructors ()
 return all constructor of this class

::acdk::lang::reflect::RField getDeclaredField (IN(RString) name) throw ( RNoSuchFieldException )
 return the field declared in this class with given variable name
Exceptions:
NoSuchFieldException if no field with given name is declared


::acdk::lang::reflect::RFieldArray getDeclaredFields ()
 return all fields declared in this class

::acdk::lang::reflect::RMethod getDeclaredMethod (IN(RString) name, IN(RClassArray) parameterTypes) throw ( RNoSuchMethodException )
 return the method with given name and parameter types.

::acdk::lang::reflect::RMethodArray getDeclaredMethods ()
 return all declared methods of this class

::acdk::lang::reflect::RField getField (IN(RString) name) throw ( RNoSuchFieldException )
 return field declared in this class or one of its parents
Exceptions:
NoSuchFieldException if no such field can be found


::acdk::lang::reflect::RFieldArray getFields ()
 return all fields declared in this class or one of its parent classes

::acdk::lang::reflect::RMethod getMethod (IN(RString) name, IN(RClassArray) parameterTypes, IN(RStringArray) namedargs=Nil) throw ( RNoSuchMethodException )
 Java compatible reflection.

::acdk::lang::reflect::RMethodArray getMethods ()
 return all methods declared in this class or one of its parent classes

RClass getDeclaringClass ()
RClassArray getClasses ()
RClassArray getDeclaredClasses ()
RClassArray getInterfaces ()
 returns the interface this class implements

::acdk::lang::reflect::RUnit getUnit ()
 returns the unit, this class resides.

int getModifiers ()
 return the clazz flags of this class

RString getName ()
RString getClassName ()
RPackage getPackage ()
 return the package in which this class is defined may return Nil

RClass getSuperclass ()
 return the super class of this class.

RClassArray getSuperClasses ()
 return all super classes (not including interfaces) at index 0 of the array always Object::GetClass()

jlong getSerialVersionUID ()
 return the declared or calculated SerialVersionUID of this class

bool isArray ()
 return true if this class is a BasicArray or a ObjectArray

RClass getArrayElementClass ()
 return the Array class, if this class is array If called on a non-array it returns Nil;

bool isAssignableFrom (IN(RClass) cls)
 return true if this class is same as parameter or one of its super class or implemented interfaces

bool isInstance (IN(RObject) obj)
 return true if given obj is exactly type of this class

bool isInterface ()
 return true if this class is an interface

bool isPrimitive ()
 return true if this class is a primitive type (like bool, int, etc.)

RObject newInstance () throw ( RInstantiationException )
 creates a new Instance of this Class Will only work if class has defined the method static acdk::lang::Object create_instance() or has a default .

RString toString ()
 reimplemented from Object

const dmi::ClazzInfoobjectClazzInfo ()
bool equals (IN(RObject) obj)
 Normally check for equality (not identity) Object::equals() is true only if both objects are the same instance.

bool equals (IN(RClass) oclass)
bool isSerializable ()
 Returns true if this class directly implements the acdk::io::Serializable interface.

bool hasWriteObject ()
 Returns true if given function is implemented in this class (not in any derivided).

bool hasReadObject ()
 Returns true if given function is implemented in this class (not in any derivided).

bool hasWriteReplace ()
 Returns true if given function is implemented in this class (not in any derivided).

bool hasReadResolve ()
 Returns true if given function is implemented in this class (not in any derivided).

bool getDmiProxies (IN(RObjectArray) proxies, IN(RObject) dmiTarget, int flags)
 create proxy for dmi.

RObject createDmiProxy (IN(RObject) dmiTarget)
 creates a DmiProxy from this class.

int compareTo (IN(RClass) other)
int compareTo (IN(RObject) other)
 compares t objects Object::compareTo() UnsupportedOperationException

virtual RString toTypeString (int format=acdk::lang::dmi::TpFtFormatStandard)
 print the information


Static Public Member Functions

RClass forName (IN(RString) className) throw ( RClassNotFoundException )
 find in in current loaded modules the given class by name

RClass forName (IN(RString) name, bool initialize) throw ( RClassNotFoundException )
 try to find the given class.

RClass findClass (IN(RString) name)
 Same as forName, but not throws an exception if a class cannot be found just return Nil;.

RClass forName (IN(RString) name, bool initialize, IN(RClassLoader) loader)
 try to find the given class.

RClass _forName (IN(RString) name)
 find in in current loaded modules the given class by name.

RObject create_arrayInstance (IN(RClass) component, int length)
RClass getSingeltonClass (const dmi::ClazzInfo *clazzInfo)
RClass getSingeltonArrayClass (const dmi::ClazzInfo *elementinfo)
dmi::ClazzInfogetSingeltonArrayClazz (const dmi::ClazzInfo *elementinfo)
dmi::ClazzInfogetUnInitializedSingeltonArrayClazz (const dmi::ClazzInfo *elementinfo)
RClass getClassByJType (IN(RString) sign)
 looking in ClazzInfo base for given Java-Signature API: ACDK


Protected Member Functions

RObject _getInstance ()
 returns the member _object if not Nil, otherwise try to create a new instance API: ACDK Status: not tested


Private Attributes

const dmi::ClazzInfo_objectClazzInfo
 Class is just a wrapper to acdk::lang::dmi::ClazzInfo.


Constructor & Destructor Documentation

acdk::lang::Class::Class const dmi::ClazzInfo clazzInfo  ) 
 

create Class with given clazzInfo

virtual acdk::lang::Class::~Class  )  [virtual]
 


Member Function Documentation

RClass acdk::lang::Class::_forName IN(RString name  )  [static]
 

find in in current loaded modules the given class by name.

Returns:
Nil if class is not loaded

RObject acdk::lang::Class::_getInstance  )  [protected]
 

returns the member _object if not Nil, otherwise try to create a new instance API: ACDK Status: not tested

int acdk::lang::Class::compareTo IN(RObject other  )  [inline, virtual]
 

compares t objects Object::compareTo() UnsupportedOperationException

Returns:
0 if equal 1 if this object is greater, -1 if ohter
Exceptions:
UnsupportedOperationException 

Reimplemented from acdk::lang::Object.

int acdk::lang::Class::compareTo IN(RClass other  )  [inline]
 

RObject acdk::lang::Class::create_arrayInstance IN(RClass component,
int  length
[static]
 

RObject acdk::lang::Class::createDmiProxy IN(RObject dmiTarget  ) 
 

creates a DmiProxy from this class.

Parameters:
dmiTarget the object where the calls will be forewarded via DMI
Returns:
Nil if no DMI-Proxy can be created. The return object will be a instance of this Class
      RObject scriptObject = getScriptObject(); // dummy code
      RStringBuffer sb = (RStringBuffer)StringBuffer::GetClass()->createDmiProxy(scriptObject);

bool acdk::lang::Class::equals IN(RClass oclass  )  [inline]
 

bool acdk::lang::Class::equals IN(RObject obj  )  [inline, virtual]
 

Normally check for equality (not identity) Object::equals() is true only if both objects are the same instance.

See also:
serialized_equals()

Reimplemented from acdk::lang::Object.

virtual void acdk::lang::Class::finalize  )  [virtual]
 

This is for java-compatibility.

For real clean using Destructor is a better way. But different to destructors inside finalize() calls to virtual methods will still be dispatched to derived classes.

Reimplemented from acdk::lang::Object.

RClass acdk::lang::Class::findClass IN(RString name  )  [static]
 

Same as forName, but not throws an exception if a class cannot be found just return Nil;.

RClass acdk::lang::Class::forName IN(RString name,
bool  initialize,
IN(RClassLoader loader
[static]
 

try to find the given class.

Try to load the class with current classloader

Parameters:
className name of the class in the form of acdk/lang/StringBuffer
initialize will be ignored
Exceptions:
ClassNotFoundException if given class cannot be found

RClass acdk::lang::Class::forName IN(RString name,
bool  initialize
throw ( RClassNotFoundException ) [static]
 

try to find the given class.

Try to load the class with current classloader

Parameters:
className name of the class in the form of acdk/lang/StringBuffer
initialize will be ignored
Exceptions:
ClassNotFoundException if given class cannot be found

RClass acdk::lang::Class::forName IN(RString className  )  throw ( RClassNotFoundException ) [static]
 

find in in current loaded modules the given class by name

Parameters:
className name of the class in the form of acdk/lang/StringBuffer
Exceptions:
ClassNotFoundException if given class cannot be found

RClass acdk::lang::Class::getArrayElementClass  ) 
 

return the Array class, if this class is array If called on a non-array it returns Nil;

RClass acdk::lang::Class::getClassByJType IN(RString sign  )  [static]
 

looking in ClazzInfo base for given Java-Signature API: ACDK

Parameters:
RString sign full qualified name

RClassArray acdk::lang::Class::getClasses  ) 
 

Deprecated:
Nested classes are not supported by ACDK
Returns:
always Array size == 0

RClassLoader acdk::lang::Class::getClassLoader  ) 
 

different to Java this method always returns the system class loader.

RString acdk::lang::Class::getClassName  ) 
 

Returns:
only classname

virtual RClass acdk::lang::Class::getComponentType  )  [virtual]
 

if this class represends an array it returns the type of the elements of the array, otherwise Nil

RClassArray acdk::lang::Class::getDeclaredClasses  ) 
 

Deprecated:
Nested classes are not supported by ACDK
Returns:
always Array size == 0

::acdk::lang::reflect::RConstructor acdk::lang::Class::getDeclaredConstructor IN(RClassArray parameterTypes  )  throw ( RNoSuchMethodException )
 

return a constructor with given parameter types

Exceptions:
NoSuchMethodException if no constructor can be found

::acdk::lang::reflect::RConstructorArray acdk::lang::Class::getDeclaredConstructors  ) 
 

return all constructor of this class

::acdk::lang::reflect::RField acdk::lang::Class::getDeclaredField IN(RString name  )  throw ( RNoSuchFieldException )
 

return the field declared in this class with given variable name

Exceptions:
NoSuchFieldException if no field with given name is declared

::acdk::lang::reflect::RFieldArray acdk::lang::Class::getDeclaredFields  ) 
 

return all fields declared in this class

::acdk::lang::reflect::RMethod acdk::lang::Class::getDeclaredMethod IN(RString name,
IN(RClassArray parameterTypes
throw ( RNoSuchMethodException )
 

return the method with given name and parameter types.

Exceptions:
NoSuchMethodException if no such method is declared in this class

::acdk::lang::reflect::RMethodArray acdk::lang::Class::getDeclaredMethods  ) 
 

return all declared methods of this class

RClass acdk::lang::Class::getDeclaringClass  ) 
 

Deprecated:
Nested classes are not supported by ACDK
Returns:
always Nil

bool acdk::lang::Class::getDmiProxies IN(RObjectArray proxies,
IN(RObject dmiTarget,
int  flags
 

create proxy for dmi.

Parameters:
proxies must initialized array. new proxies will be appended
dmiTarget where to forward the call
flags MiIvDeclared may set to create only proxy for this class and not for supers
Returns:
true if any new proxies are added to proxies

::acdk::lang::reflect::RField acdk::lang::Class::getField IN(RString name  )  throw ( RNoSuchFieldException )
 

return field declared in this class or one of its parents

Exceptions:
NoSuchFieldException if no such field can be found

::acdk::lang::reflect::RFieldArray acdk::lang::Class::getFields  ) 
 

return all fields declared in this class or one of its parent classes

RClassArray acdk::lang::Class::getInterfaces  ) 
 

returns the interface this class implements

virtual dmi::MetaInfo* acdk::lang::Class::getMetaInfo  )  [inline, virtual]
 

internal should be implemented by Class, Method, Member, and so on

Reimplemented from acdk::lang::dmi::MetaObject.

::acdk::lang::reflect::RMethod acdk::lang::Class::getMethod IN(RString name,
IN(RClassArray parameterTypes,
IN(RStringArray namedargs = Nil
throw ( RNoSuchMethodException )
 

Java compatible reflection.

Parameters:
namedargs is not implemented yet!

::acdk::lang::reflect::RMethodArray acdk::lang::Class::getMethods  ) 
 

return all methods declared in this class or one of its parent classes

int acdk::lang::Class::getModifiers  ) 
 

return the clazz flags of this class

See also:
acdk::lang::dmi::MetaInfoFlags

RString acdk::lang::Class::getName  )  [virtual]
 

Returns:
fully qualified name name/space/Class

Reimplemented from acdk::lang::Object.

RPackage acdk::lang::Class::getPackage  ) 
 

return the package in which this class is defined may return Nil

jlong acdk::lang::Class::getSerialVersionUID  ) 
 

return the declared or calculated SerialVersionUID of this class

RClass acdk::lang::Class::getSingeltonArrayClass const dmi::ClazzInfo elementinfo  )  [static]
 

dmi::ClazzInfo* acdk::lang::Class::getSingeltonArrayClazz const dmi::ClazzInfo elementinfo  )  [static]
 

RClass acdk::lang::Class::getSingeltonClass const dmi::ClazzInfo clazzInfo  )  [static]
 

RClass acdk::lang::Class::getSuperclass  ) 
 

return the super class of this class.

may return Nil.

RClassArray acdk::lang::Class::getSuperClasses  ) 
 

return all super classes (not including interfaces) at index 0 of the array always Object::GetClass()

dmi::ClazzInfo* acdk::lang::Class::getUnInitializedSingeltonArrayClazz const dmi::ClazzInfo elementinfo  )  [static]
 

::acdk::lang::reflect::RUnit acdk::lang::Class::getUnit  ) 
 

returns the unit, this class resides.

In case no Unit is defined for this class, it returns 0

bool acdk::lang::Class::hasReadObject  ) 
 

Returns true if given function is implemented in this class (not in any derivided).

API: ACDK, Serialisation

bool acdk::lang::Class::hasReadResolve  ) 
 

Returns true if given function is implemented in this class (not in any derivided).

API: ACDK, Serialisation

bool acdk::lang::Class::hasWriteObject  ) 
 

Returns true if given function is implemented in this class (not in any derivided).

API: ACDK, Serialisation

bool acdk::lang::Class::hasWriteReplace  ) 
 

Returns true if given function is implemented in this class (not in any derivided).

API: ACDK, Serialisation

bool acdk::lang::Class::isArray  ) 
 

return true if this class is a BasicArray or a ObjectArray

bool acdk::lang::Class::isAssignableFrom IN(RClass cls  ) 
 

return true if this class is same as parameter or one of its super class or implemented interfaces

bool acdk::lang::Class::isInstance IN(RObject obj  ) 
 

return true if given obj is exactly type of this class

bool acdk::lang::Class::isInterface  ) 
 

return true if this class is an interface

bool acdk::lang::Class::isPrimitive  ) 
 

return true if this class is a primitive type (like bool, int, etc.)

bool acdk::lang::Class::isSerializable  ) 
 

Returns true if this class directly implements the acdk::io::Serializable interface.

RObject acdk::lang::Class::newInstance  )  throw ( RInstantiationException )
 

creates a new Instance of this Class Will only work if class has defined the method static acdk::lang::Object create_instance() or has a default .

const dmi::ClazzInfo* acdk::lang::Class::objectClazzInfo  )  [inline]
 

Returns:
the ClazzInfo held by this Class

void acdk::lang::Class::resolve  )  [inline]
 

load full metainfo from my_shared_lib_metainf.so/dll

Exceptions:
exception if full meta info cannot be resolved

RString acdk::lang::Class::toString  )  [virtual]
 

reimplemented from Object

Returns:
for example class acdk.lang.StringBuffer

Reimplemented from acdk::lang::Object.

virtual RString acdk::lang::Class::toTypeString int  format = acdk::lang::dmi::TpFtFormatStandard  )  [inline, virtual]
 

print the information

Parameters:
format combination of acdk::lang::dmi::TypeNameFormat

Implements acdk::lang::dmi::MetaObject.


Member Data Documentation

const dmi::ClazzInfo* acdk::lang::Class::_objectClazzInfo [private]
 

Class is just a wrapper to acdk::lang::dmi::ClazzInfo.