I am new to Scala. I have a class that takes parameters as follows:
class myClass(val param: Params, val normalizer: Int){..
I have an apply method that initializes the class with default parameter values:
def apply(): myClass = new myClass(AnotherClass.getParams, 1000)
I want to restrict the normalizer parameter to allow construction of the object only if normalizer > 0, and throw an exception otherwise. However this should happen in all cases, not just in the default case in the apply method. What is the correct way to handle this situation?
Thanks, in advance.