Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47891-01

Class Class Reference

#include <coherence/lang/Class.hpp>

Inherits AnnotatedElement.

Inherited by AbstractTypedClass.

List of all members.


Detailed Description

A Class represents a managed object implementation.

Not all managed classes may have a corresponding Class representation. Classes are referred to via their demangled RTTI name, for example coherence::lang::Object.

Classes can be loaded by name via a ClassLoader.

See also:
ClassLoader
Author:
mf 2008.04.03

Public Types

typedef spec::Handle Handle
 Class Handle definition.
typedef spec::View View
 Class View definition.
typedef spec::Holder Holder
 Class Holder definition.

Public Member Functions

virtual String::View getName () const
 Return the name of the class.
virtual Object::Handle newInstance (ObjectArray::View vaParam=NULL) const
 Create a new instance of the corresponding type.
virtual const
std::type_info & 
getTypeInfo () const =0
 Return the typeinfo for the corresponding type.
virtual size32_t getSize () const =0
 Return the shallow size for an instance of the class represented by this Class.
virtual bool isInstance (Object::View v) const =0
 Return whether the passed in Object is an instance of class represented by this Class.
virtual bool isAssignableFrom (Class::View vClass) const =0
 Return true if the class represented by this object is the same Class or a super class or super interface of the specified class.
virtual Class::Handle declare (Method::View vMethod)
 Register a method with this class.
virtual Method::View getDeclaredMethod (String::View vsName, ObjectArray::View vaParams=NULL, int32_t nMod=0, bool fThrow=true) const
 Return the declared method of the specified name and parameters.
virtual ObjectArray::View getDeclaredMethods () const
 Return an array containing all the Methods declared on this Class.
virtual Method::View getMethod (String::View vsName, ObjectArray::View vaParams=NULL, int32_t nMod=0, bool fThrow=true) const
 Return the method of the specified name and parameters which is either declared or inherited by this class.
virtual ObjectArray::View getMethods () const
 Return an array containing all the Methods declared on and inherited by this Class.
virtual Class::View getSuperclass () const =0
 Return the superclass of this class, or NULL if this class an interface or top level class.
virtual ObjectArray::View getInterfaces () const =0
 Return an array of Class::View objects representing the interfaces which the Class directly implements.
virtual Class::Handle annotate (Annotation::View vAnnontation)
 Add the specified Annotation to the element.
virtual
AnnotatedElement::View 
getSuperelement () const
 Return the parent of this AnnotationElement or NULL if there is none.

The default implementation always returns NULL.

Returns:
the parent of this AnnotationElement or NULL if there is none

virtual bool equals (Object::View that) const
 Return true iff the specified Object is "equal" to this Object.

This method implements an equivalence relation on Objects:

  • It is reflexive: for any non-null handle h, h->equals(h) must return true.
  • It is symmetric: for any non-null handles h1 and h2, h1->equals(h2) should return true if and only if h2->equals(h1) returns true.
  • It is transitive: for any non-null handles h1, h2, and h3, if h1->equals(h2) returns true and h2->equals(h3) returns true, then h1->equals(h3) should return true.
  • It is consistent: for any non-null handles h1 and h2, multiple invocations of h1->equals(h2) consistently return true or consistently return false, provided no information used in comparisons on the objects is modified.
  • If the supplied handle is NULL then false must be returned.

The default implementation is a reference equality comparison.

Parameters:
v the Object::View to compare against, may be NULL
Returns:
true iff the given handle references an Object that is "equal" to this Object
See also:
equals(Object::View v1, Object::View v2)

virtual size32_t hashCode () const
 Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object


Static Public Member Functions

static String::View getClassName (Object::View v)
 Return the class name of the supplied Object.
static String::View getTypeName (const std::type_info &info)
 Return the type name of the supplied Object.

Protected Member Functions

 Class (const std::type_info &info)
 Construct a class based on a C++ type_info.

Constructor & Destructor Documentation

Class ( const std::type_info &  info  )  [protected]

Construct a class based on a C++ type_info.

Parameters:
info the type_info for the class represented by this Class.


Member Function Documentation

virtual String::View getName (  )  const [virtual]

Return the name of the class.

Returns:
the class name

virtual Object::Handle newInstance ( ObjectArray::View  vaParam = NULL  )  const [virtual]

Create a new instance of the corresponding type.

Parameters:
vaParam the object's initialization parameters
Returns:
a new instance of the corresponding type

Reimplemented in TypedBarrenClass, and TypedClass.

virtual const std::type_info& getTypeInfo (  )  const [pure virtual]

Return the typeinfo for the corresponding type.

Returns:
the typeinfo for the corresponding type

Implemented in AbstractTypedClass.

virtual size32_t getSize (  )  const [pure virtual]

Return the shallow size for an instance of the class represented by this Class.

Returns:
the shallow size of an instance of the represented class.

Implemented in AbstractTypedClass.

virtual bool isInstance ( Object::View  v  )  const [pure virtual]

Return whether the passed in Object is an instance of class represented by this Class.

Parameters:
v the object to test
Returns:
whether the passed in Object is an instance of class represented by this Class.
Since:
Coherence 3.7

Implemented in AbstractTypedClass.

virtual bool isAssignableFrom ( Class::View  vClass  )  const [pure virtual]

Return true if the class represented by this object is the same Class or a super class or super interface of the specified class.

Parameters:
vClass the class to test
Returns:
true if the specified class "extends" the class represented by this object.

Implemented in AbstractTypedClass.

virtual Class::Handle declare ( Method::View  vMethod  )  [virtual]

Register a method with this class.

Parameters:
vMethod the method to register
Since:
Coherence 3.7.1

virtual Method::View getDeclaredMethod ( String::View  vsName,
ObjectArray::View  vaParams = NULL,
int32_t  nMod = 0,
bool  fThrow = true 
) const [virtual]

Return the declared method of the specified name and parameters.

The method is supplied with an array of either parameters or parameter types expressed as Class::View objects. If non-Class objects are provided then this method will search for a Method which can accept those parameters directly. If Class objects are provided then this method will search for a Method which takes the specified type, or a superclass.

Parameters:
vsName the method name
vaParams the method parameters or types
nMod the modifiers to match
fThrow false to return NULL rather then throw on failure
Returns:
the Method
Exceptions:
NoSuchMethodException if the method is not found and fThrow == true
Since:
Coherence 3.7.1

virtual ObjectArray::View getDeclaredMethods (  )  const [virtual]

Return an array containing all the Methods declared on this Class.

Returns:
the declared methods
Since:
Coherence 3.7.1

virtual Method::View getMethod ( String::View  vsName,
ObjectArray::View  vaParams = NULL,
int32_t  nMod = 0,
bool  fThrow = true 
) const [virtual]

Return the method of the specified name and parameters which is either declared or inherited by this class.

The method is supplied with an array of either parameters or parameter types expressed as Class::View objects. If non-Class objects are provided then this method will search for a Method which can accept those parameters directly. If Class objects are provided then this method will search for a Method which takes the specified type, or a superclass.

Parameters:
vsName the method name
vaParams the method parameters or types
nMod the modifiers to match
fThrow false to return NULL rather then throw on failure
Returns:
the Method
Exceptions:
NoSuchMethodException if the method is not found and fThrow == true
Since:
Coherence 3.7.1

virtual ObjectArray::View getMethods (  )  const [virtual]

Return an array containing all the Methods declared on and inherited by this Class.

Returns:
the declared methods
Since:
Coherence 3.7.1

virtual Class::View getSuperclass (  )  const [pure virtual]

Return the superclass of this class, or NULL if this class an interface or top level class.

Returns:
the superclass
Exceptions:
ClassNotFoundException if the superclass is not registered
Since:
Coherence 3.7.1

Implemented in AbstractTypedClass.

virtual ObjectArray::View getInterfaces (  )  const [pure virtual]

Return an array of Class::View objects representing the interfaces which the Class directly implements.

Any interfaces not registered with the ClassLoader will be left out of the array.

Returns:
the array of Class::Views representing the interfaces
Since:
Coherence 3.7.1

Implemented in AbstractTypedClass.

virtual Class::Handle annotate ( Annotation::View  vAnnontation  )  [virtual]

Add the specified Annotation to the element.

Parameters:
vAnnontation the annotation
Returns:
this object

static String::View getClassName ( Object::View  v  )  [static]

Return the class name of the supplied Object.

Parameters:
v the object instance for which to obtain the class name
Returns:
the class name of the supplied Object

static String::View getTypeName ( const std::type_info &  info  )  [static]

Return the type name of the supplied Object.

Parameters:
info the type id for which to obtain the type name
Returns:
the type name of the supplied type


The documentation for this class was generated from the following file:
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.