public final class JCObject extends JCHandler implements Iterable<JCObject>, Cloneable
JCObject
class represents a reflected CLR Object. It implements
methods and accessor to interact with a CLR Object.
To instantiate a valid JCObject
use JCOBridge.NewObject(java.lang.String, java.lang.Object...)
or
JCType.NewObject(java.lang.Object...)
.
Some examples on its use are on https://github.com/masesgroup/JCOReflector
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates and returns a copy of this object as per CLR Clone.
|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one as per CLR Equals.
|
Object |
Get(String propertyName)
Retrieve an instance property from the reflected CLR Object.
|
Object |
GetField(String field)
Retrieve an instance property from the reflected CLR Object.
|
Object |
GetOnType(String propertyName)
Retrieve a property from the reflected CLR Type.
|
int |
hashCode()
This method is used to get the CLR hashCode.
|
Object |
Invoke(String method,
Object... params)
Invokes an instance method on the reflected CLR Object with optional
parameters.
|
Object |
InvokeOnType(String method,
Object... params)
Invokes a method on the reflected CLR Type with optional parameters.
|
Iterator<JCObject> |
iterator()
Returns an iterator over elements of type
JCObject . |
void |
RegisterEventListener(String eventName,
IJCEventEmit eventHandler)
Register an event callback with return value into CLR Object.
|
void |
RegisterEventListener(String eventName,
IJCVoidEventEmit eventHandler)
Register an event callback without return value into CLR Object.
|
JCObject |
Set(String propertyName,
Object value)
Sets an instance property on the reflected CLR Object.
|
JCObject |
SetField(String field,
Object value)
Sets an instance field on the reflected CLR Object.
|
String |
toString()
This method is used to get the equivalent CLR ToString.
|
void |
UnregisterEventListener(String eventName,
IJCEventEmit eventHandler)
Unregister an event callback with return value from CLR Object.
|
void |
UnregisterEventListener(String eventName,
IJCVoidEventEmit eventHandler)
Unregister an event callback without return value from CLR Object.
|
getReference
forEach, spliterator
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- if the object's class does not support the
Cloneable interface. Subclasses that
override the clone method can also throw
this exception to indicate that an
instance cannot be cloned.public boolean equals(Object obj)
public int hashCode()
public String toString()
public Object Invoke(String method, Object... params) throws JCNativeException
method
- The method to be invoked on the CLR Objectparams
- Optional parameters to pass to the methodJCObject
for all other typesJCNativeException
- In case of error in the CLR contextpublic Object Get(String propertyName) throws JCNativeException
propertyName
- The property to be get from the CLR ObjectJCObject
for all other typesJCNativeException
- In case of error in the CLR contextpublic Object GetField(String field) throws JCNativeException
field
- The field to be get from the CLR ObjectJCObject
for all other typesJCNativeException
- In case of error in the CLR contextpublic JCObject Set(String propertyName, Object value) throws JCNativeException
propertyName
- The property to be get from the CLR Objectvalue
- The value to be setJCObject
for chaining purposeJCNativeException
- In case of error in the CLR contextpublic JCObject SetField(String field, Object value) throws JCNativeException
field
- The field to be get from the CLR Objectvalue
- The value to be setJCObject
for chaining purposeJCNativeException
- In case of error in the CLR contextpublic Object InvokeOnType(String method, Object... params) throws JCNativeException
method
- The method to be invoked on the CLR Typeparams
- Optional parameters to pass to the methodJCObject
for all other typesJCNativeException
- In case of error in the CLR contextpublic Object GetOnType(String propertyName) throws JCNativeException
propertyName
- The property to be get from the CLR TypeJCObject
for all other typesJCNativeException
- In case of error in the CLR contextpublic void RegisterEventListener(String eventName, IJCVoidEventEmit eventHandler) throws JCNativeException, JCException
eventName
- The event to register into the CLR ObjecteventHandler
- The IJCVoidEventEmit
handler instance will
receive the eventJCNativeException
- In case of error in the CLR contextJCException
- In case of existing event registeredpublic void RegisterEventListener(String eventName, IJCEventEmit eventHandler) throws JCNativeException, JCException
eventName
- The event to register into the CLR ObjecteventHandler
- The IJCEventEmit
handler instance will receive
the eventJCNativeException
- In case of error in the CLR contextJCException
- In case of existing event registeredpublic void UnregisterEventListener(String eventName, IJCVoidEventEmit eventHandler) throws JCNativeException, JCException
eventName
- The event to unregister from the CLR ObjecteventHandler
- The IJCVoidEventEmit
handler instance will
receive the eventJCNativeException
- In case of error in the CLR contextJCException
- In case of unexisting event registeredpublic void UnregisterEventListener(String eventName, IJCEventEmit eventHandler) throws JCNativeException, JCException
eventName
- The event to unregister from the CLR ObjecteventHandler
- The IJCEventEmit
handler instance will receive
the eventJCNativeException
- In case of error in the CLR contextJCException
- In case of unexisting event registered