Hi Moon,
here is a simplified example. Both the object and the trait are defined in
the same section.
```
object JsonKey {
sealed abstract class JsonKey(_name: String) {
def name = _name
}
case object Email extends JsonKey("email")
case object FacebookId extends JsonKey("facebook_id")
}
trait EventProcessor extends Serializable {
def extractId(id: Int,
jsonKey: JsonKey,
map: java.util.Map[String,AnyVal]): Option[Int] = {
//Business logic (not relevant for the question)
None
}
}
```
Output:
```
defined module JsonKey <console>:22: error: not found: type JsonKey
jsonKey: JsonKey, ^
```
Regards,
Alexander Fedulov
On Thu, Oct 15, 2015 at 7:54 AM, moon soo Lee <[email protected]> wrote:
> Hi Alexander fedulov,
>
> Thanks for the sharing the problem. If you can share an example about
>
> however, when later I try to use it in a function definition within a
> trait, I get an error:
>
> that would be more helpful.
>
> Thanks,
> moon
>
> On Wed, Oct 14, 2015 at 1:26 PM <[email protected]>
> wrote:
>
>> Hi,
>>
>> I would like to use an Object in a Zeppelin notebook, something like:
>>
>> object JsonKey {
>> sealed abstract class JsonKey(_name: String) {
>> def name = _name
>> }
>> case object Email extends JsonKey("email")
>> case object FacebookId extends JsonKey("facebook_id")
>> }
>>
>> however, when later I try to use it in a function definition within a
>> trait, I get an error:
>>
>> <console>:45: error: not found: type JsonKey jsonKey: JsonKey,
>>
>> What is the problem, and is there a workaround for it?
>>
>> Regards,
>> Alexander fedulov
>>
>