alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (Field.scala)

This example Scala source code file (Field.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

field, field, fieldmetadata, tuple, tuple, type, type, value, value

The Scala Field.scala source code

/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2011, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */



package scala.dbc
package result


import scala.dbc.datatype._
import scala.dbc.value._

/** An ISO-9075:2003 (SQL) table field. */
@deprecated(DbcIsDeprecated, "2.9.0") abstract class Field {

  /** The content (value) of the field. The type of this value is undefined,
   *  transformation into a useful type will be done by an automatic view
   *  function defined in the field object.
   */
  def content: Value

  final def value[Type <: Value]: Type =
    content.asInstanceOf[Type]

  final def exactNumericValue[NativeType] =
    content.asInstanceOf[dbc.value.ExactNumeric[NativeType]]

  final def approximateNumericValue[NativeType] =
    content.asInstanceOf[dbc.value.ApproximateNumeric[NativeType]]

  final def booleanValue =
    content.asInstanceOf[dbc.value.Boolean]

  final def characterValue =
    content.asInstanceOf[dbc.value.Character]

  final def characterLargeObjectValue =
    content.asInstanceOf[dbc.value.CharacterLargeObject]

  final def characterVaryingValue =
    content.asInstanceOf[dbc.value.CharacterVarying]

  final def unknownValue =
    content.asInstanceOf[dbc.value.Unknown]

  /** The tuple that contains this field. */
  def originatingTuple: Tuple

  /** The field metadata attached to this field. */
  def metadata: FieldMetadata

}

@deprecated(DbcIsDeprecated, "2.9.0") object Field {

  implicit def fieldToValue (field: Field): Value = field.content

}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala Field.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.