ScallopOption

abstract class ScallopOption[A](nm: () => String, val cliOption: Option[CliOption], val _transformCount: Int) extends ScallopOptionBase

A class to hold a reference to not-yet-computed option values.

A class to hold a reference to not-yet-computed option values.

Basically, this is a lazy option - it batches up all operations, and evaluates the value only as the last resort.

Value Params
_transformCount

Count of .map, .filter, etc. operations applied to this option

cliOption

option descriptor (names, converters, validatiors, etc.)

nm

Name for the option

class Object
trait Matchable
class Any

Type members

Classlikes

class WithFilter(p: A => Boolean)

Value members

Concrete methods

def apply(): A

Retreive the underlying value. Use only if you are completely sure that there is a value.

Retreive the underlying value. Use only if you are completely sure that there is a value.

def collect[B](pf: PartialFunction[A, B]): ScallopOption[B]

Returns ScallopOption, that contains the result of applying pf to the value, if this option is non-empty and pf is defined for that value. Returns empty ScallopOption otherwise.

Returns ScallopOption, that contains the result of applying pf to the value, if this option is non-empty and pf is defined for that value. Returns empty ScallopOption otherwise.

Value Params
pf

the partial function

def filter(p: A => Boolean): ScallopOption[A]

Returns ScallopOption, that contains the value if applying predicate p to this value returned true. No value otherwise.

Returns ScallopOption, that contains the value if applying predicate p to this value returned true. No value otherwise.

Value Params
p

the predicate used for testing

def filterNot(p: A => Boolean): ScallopOption[A]

Returns ScallopOption, that contains the value if applying predicate p to this value returned false. No value otherwise.

Returns ScallopOption, that contains the value if applying predicate p to this value returned false. No value otherwise.

Value Params
p

the predicate used for testing

def flatMap[B](f: A => ScallopOption[B]): ScallopOption[B]

Returns the result of applying f th this options value if this option is non-empty.

Returns the result of applying f th this options value if this option is non-empty.

def foreach(f: A => Unit): Unit

Apply the given procedure f to the option's value, if it is nonempty.

Apply the given procedure f to the option's value, if it is nonempty.

def getOrElse(default: => A): A

Retrieve the underlying value if the option is nonempty, otherwise return the result of evaluating default.

Retrieve the underlying value if the option is nonempty, otherwise return the result of evaluating default.

def isDefined: Boolean

A convenience method to check whether the underlying option is defined. Just an alias for opt.get.isDefined.

A convenience method to check whether the underlying option is defined. Just an alias for opt.get.isDefined.

def isEmpty: Boolean

A convenience method to check whether the underlying option is empty. Just an alias for !opt.isDefined.

A convenience method to check whether the underlying option is empty. Just an alias for !opt.isDefined.

def isSupplied: Boolean

Tests whether the underlying value was explicitly supplied by user.

Tests whether the underlying value was explicitly supplied by user.

def map[B](f: A => B): ScallopOption[B]

Returns ScallopOption, that contains the result of applying f to this option's value, if this option is non-empty. Returns ScallopOption with no value otherwise.

Returns ScallopOption, that contains the result of applying f to this option's value, if this option is non-empty. Returns ScallopOption with no value otherwise.

Value Params
f

the function to apply

def name: String

Name for the option

Name for the option

def orElse[B >: A](alternative: => Option[B]): ScallopOption[B]

Returns ScallopOption with this value if it is non-empty, or with the value of the alternative option. If it is empty too, the resulting ScallopOption will contain None.

Returns ScallopOption with this value if it is non-empty, or with the value of the alternative option. If it is empty too, the resulting ScallopOption will contain None.

Value Params
alternative

the alternative expression

def toOption: Option[A]

Retreive the underlying value as a scala Option

Retreive the underlying value as a scala Option

override def toString: String
Definition Classes
Any
def withFilter(p: A => Boolean): WithFilter

Deprecated methods

@deprecated("use .toOption instead", "1.0.2")
def get: Option[A]

Retreive the underlying value as an option

Retreive the underlying value as an option

Deprecated

Concrete fields

val _transformCount: Int
lazy val fn: String => Option[A]
lazy val supplied: String => Boolean