Enumeration code looks like the following
package com.mydomain
object Market extends Enumeration {
type Market = Value
val ASX, LSE = Value
}
I try to use as follows
import com.mydomain.Market._
.
.
.
if (Market.ASX == currentMarket) {
...
}
This was working when everything was in the same package. When I moved to a new package I now get
not found: value Market
If you import
Market, you haveASXandLSEdirectly available to you. You don’t haveMarket.ASXavailable–that would be if you had objectMarketavailable, which is what would happen if you didimport com.mydomain._.Being inside package
com.mydomaincausescom.mydomain._to be loaded just like you imported it, so that’s why you can sayMarket.ASXwhen you’re in the same package.When you write code in a different package, you need to either
import com.mydomain._and then useMarket.ASX, orimport com.mydomain.Market._and then useASX.