I think the answer is no, or at least I've never seen it. But I thought I'd ask the collective wisdom of the Ranchers.
Can it? If so, how?
Thanks
Pat
Ireneusz Kordal
Ranch Hand
Joined: Jun 21, 2008
Posts: 423
posted
0
Interface cannot contain static functions.
Could contain only static fields (fields in interface is always implicitly 'public static final', even if these modifiers are omitted).
Mike Simmons
Ranch Hand
Joined: Mar 05, 2008
Posts: 2782
2
posted
0
Since you're asking for "collective wisdom", I'll confirm that Ireneusz is completely correct here - interfaces can never declare static methods. There's no way to do this in Java. The closest options I can think of are to either refactor to make the methods non-static, or add some reflection-based code that checks at runtime to see if a given class implements the methods you require. I don't see a way to do better.