public abstract class ComObject extends java.lang.Object implements WrappedResource
comhandle
s. Does minimal
management of the COM Object.Modifier and Type | Field and Description |
---|---|
private ControlFrameWidget |
parentControlFrame
The parent
ControlFrameWidget widget. |
private java.lang.Long |
resourceId
The resource id.
|
Constructor and Description |
---|
ComObject()
Build a new COM Object.
|
Modifier and Type | Method and Description |
---|---|
BaseDataType |
call(java.lang.String methodName,
java.lang.Object... params)
Calls a COM-method without parameters on the COM-object stored in this com-handle.
|
comhandle |
chainCall(java.lang.String methodName,
java.lang.Object... params)
Calls a COM-method without parameters on the COM-object stored in this com-handle.
|
protected static void |
checkParameters(BaseDataType[][] vals,
java.lang.Object[] params)
Check the parameters received from a COM method call and copy the values into OUTPUT or
INPUT-OUTPUT arguments.
|
void |
destroy()
Destroy all resources kept by FWD related to this COM object.
|
private java.lang.reflect.Method |
getComAccessor(java.lang.String prop,
boolean setter)
Internal utility method that selects an accessor for a property from a COM object.
|
abstract java.lang.String |
getName()
Obtain the name of this COM object.
|
ControlFrameWidget |
getParentControlFrame()
Obtain the
ControlFrameWidget container for this COM, if any. |
BaseDataType |
getProperty(java.lang.String prop)
Obtain a property value from the COM object stored in this handle.
|
java.lang.Long |
id()
Get this resource's ID, if is already set.
|
void |
id(long id)
Set this resource's ID.
|
protected static BaseDataType |
marshal(java.lang.Object aVal)
Converts a value to a BDT object.
|
protected static BaseDataType |
marshal(java.lang.Object aVal,
java.lang.Class<?> bdtClass)
Converts a value to a BDT object.
|
abstract void |
release()
Perform actual delete of all resources.
|
void |
setParentControlFrame(ControlFrameWidget pcf)
Sets the
ControlFrameWidget container for this COM. |
boolean |
setProperty(java.lang.String prop,
java.lang.Object newVal,
java.lang.Object... indices)
Sets a COM property for the COM object stored by the handle.
|
boolean |
unknown()
Reports if this object is unknown.
|
protected static ComParameter |
unmarshal(java.lang.Object aVal)
Converts a value from a
ComParameter , BaseDataType or other Java type to
a ComParameter instance which can be passed as an argument to a COM method call. |
protected static ComParameter[] |
unmarshal(java.lang.Object[] aVals)
Converts an array of values from a
ComParameter , BaseDataType or other Java
type to a ComParameter instance which can be passed as an argument to a COM method
call. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
valid
private java.lang.Long resourceId
WrappedResource
management.private ControlFrameWidget parentControlFrame
ControlFrameWidget
widget. This container is used during the dispatch of
the events generated by this COM Object.protected static BaseDataType marshal(java.lang.Object aVal)
BaseDataType
, in fact is assume it is not. Note that, because this method uses the
best matching constructor, this method may do some implicit conversions if the passed in
value is compatible with the class required (like from a String
).aVal
- The value to be converted.BaseDataType
instance that represent the same value as aVal
.protected static BaseDataType marshal(java.lang.Object aVal, java.lang.Class<?> bdtClass)
BaseDataType
, in fact is assume it is not. Note that, because this method uses the
best matching constructor, this method may do some implicit conversions if the passed in
value is compatible with the class required (like from a String
).aVal
- The value to be converted.bdtClass
- The type of the returned result (as a subclass of BaseDataType
).BaseDataType
instance that represent the same value as aVal
.protected static ComParameter unmarshal(java.lang.Object aVal)
ComParameter
, BaseDataType
or other Java type to
a ComParameter
instance which can be passed as an argument to a COM method call.aVal
- The value to be converted.ComParameter
instance.java.lang.IllegalArgumentException
- If the value can't be passed by FWD as an argument for a COM method call.protected static ComParameter[] unmarshal(java.lang.Object[] aVals)
ComParameter
, BaseDataType
or other Java
type to a ComParameter
instance which can be passed as an argument to a COM method
call.aVals
- The values to be converted.ComParameter
instance.java.lang.IllegalArgumentException
- If the value can't be passed by FWD as an argument for a COM method call.protected static void checkParameters(BaseDataType[][] vals, java.lang.Object[] params)
vals
- The received values. The arguments are 1-indexed (as on index 0 is the return
value), and each argument has an entry in this array; null
values
represent INPUT arguments or unknown
values.params
- The actual references received by FWD for this method call. All OUTPUT or INPUT-
OUTPUT arguments must be ComParameter
instances.public boolean unknown()
unknown
in interface WrappedResource
true
if object is unknown.public java.lang.Long id()
id
in interface WrappedResource
null
if not set.public void id(long id)
id
in interface WrappedResource
id
- The resource's ID.public abstract java.lang.String getName()
public abstract void release()
public final void destroy()
public ControlFrameWidget getParentControlFrame()
ControlFrameWidget
container for this COM, if any.public void setParentControlFrame(ControlFrameWidget pcf)
ControlFrameWidget
container for this COM.pcf
- The container for this COM.public boolean setProperty(java.lang.String prop, java.lang.Object newVal, java.lang.Object... indices)
prop
- The legacy property name. Case insensitive. If no property is found then a warning
is displayed and method returns without altering the stored object.newVal
- The new value for the property. It must be of a compatible type with the property.indices
- A variable number of indices used to access this property's element.true
if the property was set.PropertyAccessException
- If the the property was found but there was an error during setting.public BaseDataType getProperty(java.lang.String prop)
prop
- The legacy name of the property. Case insensitive. If no property is found then a
warning is displayed and method returns unknown
value.unknown
on exceptions.public BaseDataType call(java.lang.String methodName, java.lang.Object... params)
methodName
- The method name. Case insensitive. If the COM-object does not declare such method
an error message is displayed and this method returns unknown
value.params
- The list of actual parameters. Their types must be compatible with the parameters
of called method.
TODO: marshal to BDT (?) When code is generated [param] is already BDT.public comhandle chainCall(java.lang.String methodName, java.lang.Object... params)
methodName
- The method name. Case insensitive. If the COM-object does not declare such method
an error message is displayed and this method returns unknown
value.params
- The list of actual parameters. Their types must be compatible with the parameters
of called method.
TODO: marshal to BDT (?) When code is generated [param] is already BDT.comhandle
, so it can be used in a
chained call or property access.private java.lang.reflect.Method getComAccessor(java.lang.String prop, boolean setter)
prop
- The property being searched. The accessor method (setter or getter) must be
annotated with proper ComProperty
annotation.setter
- true
for setter methods and false
for getters. In either case a
quick check is performed to verify whether the eventually found method are the
requested kind of accessors.null
if no such property
was found or it does not meet the minimum syntactic conditions.