← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #241889]: PatternOrString interface source

 

Question #241889 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/241889

    Status: Open => Answered

RaiMan proposed the following answer:
Not a trick, but some defined Java language construct (should be from
Generics stuff), to avoid Object parameters and be more declarative.

So instead of saying:
public someMethod(Object parm) { }

you can use
public <PatternOrString> void someMethod(PatternOrString parm) { }

Nevertheless you have to cast parm to the correct type inside after
having evaluated the type somehow (e.g. with instanceof)

Be Aware: Do not dive too deep into version 1.0.1 though, with version
1.1.0 things are changing dramatically inside at some places (e.g. class
Region)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.