Logo QF-Test

Finding valuable answers
in the Mailing List Archive.

 

Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2016 up to now | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2007


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Resolver Hook with isInstance()


  • Subject: Re: [QF-Test] Resolver Hook with isInstance()
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 12 Nov 2007 21:23:20 +0100

Hi Michael,

there is no default isInstance method in Java or Python that takes a
String as argument.

In Java there is

    class.isInstance(obj)

and in Python there's the builtin

    isinstance(obj, class)

Both methods require you to first import the class you want to test
against.

For convenience QF-Test provides a static method in the
ResolverRegistry that will perform isInstance against a class name:

from de.qfs.apps.qftest.extensions import ResolverRegistry
ResolverRegistry.isInstance(obj, "javax.swing.Button")

This method is ideal for Jython based scripts and NameResolvers.

Best regards,
    Greg

"Michael Werner" <michael.werner@?.com> writes:

>    Hi,
>
>
>    I am trying to write a Resolver Hook, in the Form
>
>
>    -----------------------------------------------------------------------
>    ---------------
>
>    def getName(obj):
>
>                if(obj.isInstance("javax.swing.JButton")):
>
>                            return return JButton.getActionCommand()
>
>                elif(obj.isInstance("javax.swing.JPanel")):
>
>                            return "TODO: JPanel"
>
>                ...
>
>    resolvers.addNameResolver("JButtons", getName,"javax.swing.JButton")
>
>    resolvers.addNameResolver("JPanel", getName,"javax.swing.JPanel")
>
>    resolvers.addNameResolver(".....
>
>    -----------------------------------------------------------------------
>    ---------------
>
>
>    But, this does not Work. The Hooks all work, if I use them alone,
>    without the obj.isInstance() condition.
>
>
>    Has anyone an idea what is wrong there?
>
>
>    Regards,
>
>    Michael
>
>
>
>    [cid:image001.gif@?.887B2790]
>
>
>    Michael Werner
>
>
>
>
>    Ericsson GmbH
>
>
>    EDD/XMB/DB
>
>    Gerberstr. 33
>
>    71522, Backnang, Germany,
>    www.ericsson.com
>
>
>
>    Email  : [1]Michael.Werner@?.com
>
>
>    Ericsson GmbH. Sitz: Düsseldorf. Registergericht: Amtsgericht
>    Düsseldorf, HRB 33012. Geschäftsführer: Dr. Stefan Kindt, Carsten
>    Ahrens. Aufsichtsratsvorsitzender: Jef Keustermans
>
>
>    This communication is confidential and intended solely for the
>    addressee(s). Any unauthorized review, use, disclosure or distribution
>    is prohibited. If you believe this message has been sent to you in
>    error, please notify the sender by replying to this transmission and
>    delete the message without disclosing it. Thank you.
>    E-mail including attachments is susceptible to data corruption,
>    interception, unauthorized amendment, tampering and viruses, and we
>    only send and receive emails on the basis that we are not liable for
>    any such corruption, interception, amendment, tampering or viruses or
>    any consequences thereof.
>
> Verweise
>
>    1. mailto:Michael.Werner@?.com
> _______________________________________________
> qftest-list mailing list
> qftest-list@?.de
> http://www.qfs.de/mailman/listinfo/qftest-list

--
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876
GF: Gregor Schmid, Karlheinz Kellerer          HRB München 140833



Videos Downloads Documentation Buy Free Trial