Extractor

com.phasmidsoftware.xmldoc.xml.Extractor
See theExtractor companion object
trait Extractor[T] extends NamedFunction[Extractor[T]]

Trait to define the behavior of an extractor (parser) that takes an XML Node and return Try[T] where T is the underlying type of the Extractor.

Type parameters

T

the type to be constructed.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type

Members list

Value members

Abstract methods

def extract(node: Node): Try[T]

Method to convert a Node into a Try[T].

Method to convert a Node into a Try[T].

Value parameters

node

a Node.

Attributes

Returns

a Try[T].

Concrete methods

def flatMap[U](f: T => Try[U]): Extractor[U]

Method to flatMap this Extractor[T] into an Extractor[U].

Method to flatMap this Extractor[T] into an Extractor[U].

Type parameters

U

the underlying type of the result.

Value parameters

f

a T => Try[U].

Attributes

Returns

an Extractor[U].

def lift: Extractor[Option[T]]

Lifts this Extractor[T] into an Extractor[Option[T]]. If the extraction is successful, the resulting value is wrapped in Some.

Lifts this Extractor[T] into an Extractor[Option[T]]. If the extraction is successful, the resulting value is wrapped in Some.

Attributes

Returns

an Extractor[Option[T]], which extracts an Option[T] from a Node.

def map[U](f: T => U): Extractor[U]

Method to map this Extractor[T] into an Extractor[U].

Method to map this Extractor[T] into an Extractor[U].

Type parameters

U

the underlying type of the result.

Value parameters

f

a T => U.

Attributes

Returns

an Extractor[U].

def |[P <: T : Extractor](): Extractor[T]

Method to create an Extractor[T] such that, if this Extractor[T] fails, then we invoke the (implicit) Extractor[P] instead.

Method to create an Extractor[T] such that, if this Extractor[T] fails, then we invoke the (implicit) Extractor[P] instead.

TESTME

Type parameters

P

the type of the alternative Extractor. P must provide implicit evidence of Extractor[P], and P must be a subclass of T.

Attributes

Returns

an Extractor[T].

Inherited methods

def ^+(w: String): Extractor[T]

Appends the given string to the current name, separated by a colon, and updates the name of the current instance.

Appends the given string to the current name, separated by a colon, and updates the name of the current instance.

Value parameters

w

the string to prepend to the current name.

Attributes

Returns

the instance of the current object cast to type E.

Inherited from:
NamedFunction
def ^^(w: String): Extractor[T]

Updates the name of the current instance and returns it as the specified type.

Updates the name of the current instance and returns it as the specified type.

Value parameters

w

the new name to be assigned.

Attributes

Returns

the instance of the current object cast to type E.

Inherited from:
NamedFunction
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
NamedFunction -> Any
Inherited from:
NamedFunction

Inherited fields

var name: String

Represents the name attribute of a NamedFunction instance.

Represents the name attribute of a NamedFunction instance.

The name is a mutable string variable with a default value of "unnamed". It can be updated via methods such as ^^ and ^+ in the NamedFunction trait.

Attributes

Inherited from:
NamedFunction