is it possible to return and objects type
I am aware of the
if (blah instanceof string == true)
but I would like to do something like
System.debug ("your object type is : " + blah.objectype)
output expected would be
your object type is: string
the reason I need this is I have a couple of instances where I believe I am passing in the correct object types but the actions are failing based on instanceof error handling detecting the wrong object types.
I believe the objects are of the correct type but I can't prove or disprove it.
usually there is the System.getObjectType()-method. But unfotunately it does not work always (don't know if bug or by-design ).
But you can just log-out the object itself, and it will show you the type.
Example (both):
var custSpec = new VcCustomizationSpec();
custSpec.identity = new VcCustomizationIdentitySettings();
System.debug(System.getObjectType(custSpec));
System.debug(custSpec);
gives:
[2011-04-29 08:33:16.664] [D] null
[2011-04-29 08:33:16.665] [D] DynamicWrapper (Instance) : [VcCustomizationSpec]-[class com.vmware.vim.vi4.CustomizationSpec] -- VALUE : com.vmware.vim.vi4.CustomizationSpec@2...
Regards,
Joerg
Hi,
Use System.getObjectType(blah);
You can also use System.getObjectClassName(blah) -> This fixes Joerg null issue.
Christophe.
usually there is the System.getObjectType()-method. But unfotunately it does not work always (don't know if bug or by-design ).
But you can just log-out the object itself, and it will show you the type.
Example (both):
var custSpec = new VcCustomizationSpec();
custSpec.identity = new VcCustomizationIdentitySettings();
System.debug(System.getObjectType(custSpec));
System.debug(custSpec);
gives:
[2011-04-29 08:33:16.664] [D] null
[2011-04-29 08:33:16.665] [D] DynamicWrapper (Instance) : [VcCustomizationSpec]-[class com.vmware.vim.vi4.CustomizationSpec] -- VALUE : com.vmware.vim.vi4.CustomizationSpec@2...
Regards,
Joerg