unsafe

info.fingo.spata.Record.unsafe$
object unsafe

Access to unsafe (exception throwing) methods

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
unsafe.type

Members list

Type members

Classlikes

final class Field[A]

Intermediary to delegate parsing to in order to infer type of formatter used by parser.

Intermediary to delegate parsing to in order to infer type of formatter used by parser.

Type parameters

A

target type for parsing

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply(key: String): String

Gets field value.

Gets field value.

Value parameters

key

the key of retrieved field

Attributes

Returns

field value in original, string format

Throws
NoSuchElementException

when incorrect key is provided

def apply(idx: Int): String

Gets field value.

Gets field value.

Value parameters

idx

the index of retrieved field, starting from 0

Attributes

Returns

field value in original, string format

Throws
IndexOutOfBoundsException

when incorrect index is provided

def get[A : StringParser](key: String): A

Gets typed record value.

Gets typed record value.

Parsers for basic types are provided through StringParser object.

To parse optional values provide Option[?] as type parameter. Parsing empty value to simple type will throw an exception.

Type parameters

A

type to parse the field to

Value parameters

key

the key of retrieved field

Attributes

Returns

parsed value

Throws
error.ContentError

if field cannot be parsed to requested type or incorrect key is provided

See also

StringParser for information on providing custom parsers.

Note

When relying on default string parsers, this function assumes "standard" string formatting, without any locale support, e.g. point as decimal separator or ISO date and time formats. Use get or provide own parser if more control over source format is required.

def get[A]: Field[A]

Gets typed record value. Supports custom string formats through Pattern.

Gets typed record value. Supports custom string formats through Pattern.

The combination of get, Field constructor and apply method allows value retrieval in following form:

val date: LocalDate = record.unsafe.get[LocalDate]("key", DateTimeFormatter.ofPattern("dd.MM.yy"))

(type of formatter is inferred based on target type).

Parsers for basic types (as required by Field) are available through StringParser object. Additional ones may be provided as given instances.

To parse optional values provide Option[?] as type parameter. Parsing empty value to simple type will throw an exception.

Type parameters

A

type to parse the field to

Attributes

Returns

intermediary to retrieve value according to custom format

See also

StringParser for information on providing custom parsers.