t

Any.Able.ToInfo

trait ToInfo extends Any.Able.ToText with Any.Able.ToString

Self Documentation

Any.Able.ToInfo allows any object to document itself

// Actual scalqa.App.Memory object code
object Memory extends Any.Able.ToInfo {
  private def rt = Runtime.getRuntime
  def total: ByteSize = rt.totalMemory
  def max: ByteSize = rt.maxMemory
  def free: ByteSize = rt.freeMemory
  def used: ByteSize = total - free
  def gc: Unit = java.lang.System.gc

  def toInfo = new Pro.Info(this) += ("max", max) += ("total", total) += ("free", free) += ("used", used)
}

App.Memory.lp                 // Prints: App.Memory{max=15.2g,total=1.0g,free=985.8m,used=43.3m}

App.Memory.toInfo.toBrief.lp  // Prints: App.Memory{15.2gB,1.0gB,986.2mB,42.9mB}

App.Memory.toInfo.toText.lp   // Prints: App.Memory{max=15.2g,
                              //                    total=1.0g,
                              //                    free=985.8m,
                              //                    used=43.3m}
Ordering
  1. Alphabetic
Inherited
  1. ToInfo
  2. Any.Able.ToString
  3. Any.Able.ToText
  4. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  2. def equals(arg0: Any): Boolean
    Definition Classes
    Any
  3. def hashCode(): Int
    Definition Classes
    Any
  4. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  5. abstract def toInfo: Pro.Info

    Info

    Info

    Returns Pro.Info object, loaded with property names and values describing this instance

    Definition Classes
    ToInfo
  6. def toString: String

    Custom single line description

    Custom single line description

    If not overridden further, toString returns toInfo.toString

    Definition Classes
    ToInfoToString → Any
  7. def toText: String

    Custom multi line description

    Custom multi line description

    If not overridden further, toText returns toInfo.toText

    Definition Classes
    ToInfoToText

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any