Ghiro
Ghiro

Reputation: 520

Xtend tip: how do I access a static method within a Java interface inner class?

// java
interface MyInterface { 
    class MyInnerClass {            
        public static final String myInnerStaticMethod() {
            return "myInnerStaticMethod";
        }       
    }
}

How can I call this from an Xtend method?

Upvotes: 2

Views: 314

Answers (2)

Viliam Simko
Viliam Simko

Reputation: 1841

Actually, the latest version of Xtend (>2.4.1) uses much nicer syntax.

// xtend
def test() {
  MyInterface.MyInnerClass.myInnerStaticMethod
}

Upvotes: 2

Ghiro
Ghiro

Reputation: 520

// xtend
def test() {
    MyInterface$MyInnerClass::myInnerStaticMethod
}

Upvotes: 2

Related Questions