I have a class defined like so (pseudo code):
package com.some.namespace
public class SomeClass {
protected SomeClass() {}
// stuff...
public class SomeInnerClass {
public SomeInnerClass() {}
// more stuff (accesses instance variables from SomeClass)...
}
}
Then in my template I use the reusable block defines like so:
@doSomething(val: com.some.namespace.SomeClass.SomeInnerClass) = {
// even more stuff...
}
But I get the error:
type SomeInnerClass is not a member of object com.some.namespace.SomeClass
Am I not able to access inner classes within the templates or is this supposed to work? (if it is supposed to work I might need to post my actual code)
It should work, but because
SomeInnerClass
is a dependent type, i.e. dependent on your singleton outer class instance, you need to write it like:The
SomeClass#SomeInnerClass
syntax in Scala means, vaguely, aSomeInnerClass
from any instance ofSomeClass
. See this answer for more detail.If the inner class was static, however, your current
SomeClass.SomeInnerClass
syntax would be the way to go.