src/Pure/General/untyped.scala
author wenzelm
Mon, 21 Jul 2014 16:58:12 +0200
changeset 57593 2f7d91242b99
parent 56905 fb38a767a78b
child 58682 542fa5093ebf
permissions -rw-r--r--
proper Swing buttons instead of active areas within text (by Lars Hupel);

/*  Title:      Pure/General/untyped.scala
    Module:     PIDE
    Author:     Makarius

Untyped, unscoped, unchecked access to JVM objects.
*/

package isabelle


object Untyped
{
  def get(obj: AnyRef, x: String): AnyRef =
  {
    obj.getClass.getDeclaredFields.find(_.getName == x) match {
      case Some(field) =>
        field.setAccessible(true)
        field.get(obj)
      case None => error("No field " + quote(x) + " for " + obj)
    }
  }
}