Trait

scala.reflect.api.Mirrors

FieldMirror

Related Doc: package Mirrors

Permalink

trait FieldMirror extends AnyRef

A mirror that reflects a field. See the overview page for details on how to use runtime reflection.

Source
Mirrors.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FieldMirror
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def bind(newReceiver: Any): Universe.FieldMirror

    Permalink

    Creates a new mirror which uses the same symbol, but is bound to a different receiver.

    Creates a new mirror which uses the same symbol, but is bound to a different receiver. This is significantly faster than recreating the mirror from scratch.

  2. abstract def get: Any

    Permalink

    Retrieves the value stored in the field.

    Retrieves the value stored in the field.

    Scala reflection uses reflection capabilities of the underlying platform, so FieldMirror.get might throw platform-specific exceptions associated with getting a field or invoking a getter method of the field.

    If symbol represents a field of a base class with respect to the class of the receiver, and this base field is overridden in the class of the receiver, then this method will retrieve the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor.

  3. abstract def receiver: Any

    Permalink

    The object containing the field

  4. abstract def set(value: Any): Unit

    Permalink

    Updates the value stored in the field.

    Updates the value stored in the field.

    If a field is immutable, a ScalaReflectionException will be thrown.

    Scala reflection uses reflection capabilities of the underlying platform, so FieldMirror.get might throw platform-specific exceptions associated with setting a field or invoking a setter method of the field.

    If symbol represents a field of a base class with respect to the class of the receiver, and this base field is overridden in the class of the receiver, then this method will set the value of the base field. To achieve overriding behavior, use reflectMethod on an accessor.

  5. abstract def symbol: Universe.TermSymbol

    Permalink

    The field symbol representing the field.

    The field symbol representing the field.

    In Scala val and var declarations are usually compiled down to a pair of a backing field and corresponding accessor/accessors, which means that a single declaration might correspond to up to three different symbols. Nevertheless the FieldMirror.symbol field always points to a backing field symbol.