shohaku.core.io
クラス IntrospectWriter

java.lang.Object
  拡張java.io.Writer
      拡張java.io.PrintWriter
          拡張shohaku.core.io.IntrospectWriter
直系の既知のサブクラス:
DebugPrintWriter

public class IntrospectWriter
extends java.io.PrintWriter

オブジェクトの内部情報を出力する機能を持つ拡張プリントライターを提供します。

配列・多次元配列の要素の出力や日付のフォーマット出力、 javaBean のプロパティ出力等の機能が提供されています。


入れ子クラスの概要
static interface IntrospectWriter.Printer
          IntrospectWriter.print(Object o) で使用される出力機能を定義します。
 
フィールドの概要
protected static java.util.List DEFAULT_PRINTERS
          デフォルトの出力プリンタを格納します。
 
クラス java.io.PrintWriter から継承したフィールド
out
 
クラス java.io.Writer から継承したフィールド
lock
 
コンストラクタの概要
IntrospectWriter()
          標準の出力ストリームへ出力する IntrospectWriter を構築します。
IntrospectWriter(boolean autoFlush)
          標準の出力ストリームへ出力する IntrospectWriter を構築します。
IntrospectWriter(java.io.OutputStream out)
          指定された出力ストリームから新しい IntrospectWriter を構築します。
IntrospectWriter(java.io.OutputStream out, boolean autoFlush)
          指定された出力ストリームから新しい IntrospectWriter を構築します。
IntrospectWriter(java.io.Writer out)
          自動行フラッシュは行わずに、新しい IntrospectWriter を構築します。
IntrospectWriter(java.io.Writer out, boolean autoFlush)
          新しい IntrospectWriter を構築します。
 
メソッドの概要
 void addPrinter(IntrospectWriter.Printer printer)
          出力プリンタを追加します。
 IntrospectWriter.Printer[] getPrinters()
          登録済みの出力プリンタを返却します。
 void print(java.lang.Object o)
          登録済みの出力プリンタを使用して出力ストリームへ出力します。
 void print(java.lang.Object o, IntrospectWriter.Printer printer)
          出力プリンタを使用して出力ストリームへ出力します。
 void printArray(java.lang.Object a)
          多次元配列を出力します。
 void printArray(java.lang.Object title, java.lang.Object a)
          タイトルと多次元配列を出力します。
 void printBean(java.lang.Object bean)
          JavaBean の保有するプロパティを全て出力します。
 void printBeans(java.lang.Object[] beans)
          全ての JavaBean の保有するプロパティを全て出力します。
 void printClass(java.lang.Object c)
          クラス型を拡張書式で出力します。
 void printColl(java.util.Collection c)
          コレクションを出力します。
 void printConstants(java.lang.Class c)
          public, static, final であるフィールドを全て出力します。
 void printFields(java.lang.Object o)
          public であるフィールドを全て出力します。
 void printlf(int len)
          引数分の改行を出力します。
 void println(java.lang.Object o, IntrospectWriter.Printer printer)
          出力プリンタを使用して出力ストリームへ出力して改行します。
 void printMap(java.util.Map m)
          マップを出力します。
 void printsp(int len)
          引数分のスペースを出力します。
 boolean removePrinter(IntrospectWriter.Printer printer)
          出力プリンタを削除します。
 
クラス java.io.PrintWriter から継承したメソッド
checkError, close, flush, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

DEFAULT_PRINTERS

protected static final java.util.List DEFAULT_PRINTERS
デフォルトの出力プリンタを格納します。

コンストラクタの詳細

IntrospectWriter

public IntrospectWriter()
標準の出力ストリームへ出力する IntrospectWriter を構築します。


IntrospectWriter

public IntrospectWriter(boolean autoFlush)
標準の出力ストリームへ出力する IntrospectWriter を構築します。

パラメータ:
autoFlush - true の場合 println() メソッドでは出力バッファをフラッシュする

IntrospectWriter

public IntrospectWriter(java.io.OutputStream out)
指定された出力ストリームから新しい IntrospectWriter を構築します。
これにより、デフォルトの文字エンコーディングを使って文字をバイトに変換します。

パラメータ:
out - 出力ストリーム

IntrospectWriter

public IntrospectWriter(java.io.OutputStream out,
                        boolean autoFlush)
指定された出力ストリームから新しい IntrospectWriter を構築します。
これにより、デフォルトの文字エンコーディングを使って文字をバイトに変換します。

パラメータ:
out - 出力ストリーム
autoFlush - true の場合 println() メソッドでは出力バッファをフラッシュする

IntrospectWriter

public IntrospectWriter(java.io.Writer out)
自動行フラッシュは行わずに、新しい IntrospectWriter を構築します。

パラメータ:
out - 文字出力ストリーム

IntrospectWriter

public IntrospectWriter(java.io.Writer out,
                        boolean autoFlush)
新しい IntrospectWriter を構築します。

パラメータ:
out - 文字出力ストリーム
autoFlush - true の場合 println() メソッドでは出力バッファをフラッシュする
メソッドの詳細

print

public void print(java.lang.Object o)
登録済みの出力プリンタを使用して出力ストリームへ出力します。

パラメータ:
o - 出力値

print

public void print(java.lang.Object o,
                  IntrospectWriter.Printer printer)
出力プリンタを使用して出力ストリームへ出力します。
Printer.isAssignable(Object)true の場合のみ出力されます。

パラメータ:
o - 出力値
printer - 出力プリンタ

println

public void println(java.lang.Object o,
                    IntrospectWriter.Printer printer)
出力プリンタを使用して出力ストリームへ出力して改行します。
Printer.isAssignable(Object)true の場合のみ出力されます。

パラメータ:
o - 出力値
printer - 出力プリンタ

printlf

public void printlf(int len)
引数分の改行を出力します。

パラメータ:
len - 改行数

printsp

public void printsp(int len)
引数分のスペースを出力します。

パラメータ:
len - スペース数

printArray

public void printArray(java.lang.Object a)
多次元配列を出力します。
  <ArrayClassType(length)>[item1, item2, <ArrayClassType(length)>[item3-1, item3-2, …], item4]
 
配列以外は print(Object) を呼ぶ

パラメータ:
a - 出力値

printArray

public void printArray(java.lang.Object title,
                       java.lang.Object a)
タイトルと多次元配列を出力します。
  タイトル : <ArrayClassType(length)>[item1, item2, <ArrayClassType(length)>[item3-1, item3-2, …], item4]
 

パラメータ:
title - タイトル
a - 出力値

printColl

public void printColl(java.util.Collection c)
コレクションを出力します。
     ClassName[ item1, item2, item3, … ]
 

パラメータ:
c - 出力値

printMap

public void printMap(java.util.Map m)
マップを出力します。
  ClassName{ key1:value1, key2:value2, key3:value3, … }
 

パラメータ:
m - 出力値

printBean

public void printBean(java.lang.Object bean)
JavaBean の保有するプロパティを全て出力します。
  ClassName{ property1=value1, property2=value2, … }
 

パラメータ:
bean - 出力する JavaBean

printBeans

public void printBeans(java.lang.Object[] beans)
全ての JavaBean の保有するプロパティを全て出力します。
     ArrayClassType[length]
       [
       [0]ClassName{ property1=value1, property2=value2, … }
       [1]ClassName{ property1=value1, property2=value2, … }
       …
     ]
 

パラメータ:
beans - 出力する JavaBean の配列

printConstants

public void printConstants(java.lang.Class c)
public, static, final であるフィールドを全て出力します。
     ClassName{
       public static final [field name1] = [field value1]
       public static final transient [field name2] = [field value2]
       ・・・
     }
 

パラメータ:
c - 出力するクラス

printFields

public void printFields(java.lang.Object o)
public であるフィールドを全て出力します。
     ClassName{
       public static final [field name1] = [field value1]
       public static [field name2] = [field value2]
       public final [field name3] = [field value3]
       public [field name4] = [field value4]
       public transient [field name5] = [field value5]
       public volatile [field name6] = [field value6]
       ・・・
     }  
 

パラメータ:
o - 出力するオブジェクト

getPrinters

public IntrospectWriter.Printer[] getPrinters()
登録済みの出力プリンタを返却します。

戻り値:
出力プリンタ

addPrinter

public void addPrinter(IntrospectWriter.Printer printer)
出力プリンタを追加します。

パラメータ:
printer - 出力プリンタ

removePrinter

public boolean removePrinter(IntrospectWriter.Printer printer)
出力プリンタを削除します。

パラメータ:
printer - 出力プリンタ
戻り値:
削除が実際に行われた場合 true を返す

printClass

public void printClass(java.lang.Object c)
クラス型を拡張書式で出力します。

パラメータ:
c - 出力するクラス型