Reputation: 2916
I have a generic class for which the type must be a subtype of Enumeration
class MyClass[A<: Enumeration](val parameter1 : Int,
val parameter2: A) {
}
Inside this class, there is a method that needs to take an element from the enum A
as parameter. I cannot find the proper way to write the signature of the method.
def myMethod(element: A.Values): Resource2[A] = {
this
}
Intellisense says
Cannot resolve symbol A
How can I write the method so it takes an element of the enum A
?
Upvotes: 0
Views: 175
Reputation: 51271
The type is Value
(not Values
) and, because A
is a type and not an instance (i.e. not a value), the syntax for referencing a type within a type is element: A#Value
.
Upvotes: 2