クラス TestCompiler

java.lang.ObjectSE
org.springframework.core.test.tools.TestCompiler

public final class TestCompiler extends ObjectSE
Java ソースコードを動的にコンパイルおよびテストするために使用できるユーティリティ。
導入:
6.0
作成者:
Phillip Webb, Scott Frederick, Stephane Nicoll
関連事項:
  • メソッドの詳細

    • forSystem

      public static TestCompiler forSystem()
      システム java コンパイラーに基づく新しい TestCompiler を作成します。
      戻り値:
      新しい TestCompiler インスタンス
    • forCompiler

      public static TestCompiler forCompiler(JavaCompilerSE javaCompiler)
      指定された JavaCompilerSE に基づく新しい TestCompiler を作成します。
      パラメーター:
      javaCompiler - 使用する java コンパイラー
      戻り値:
      新しい TestCompiler インスタンス
    • with

      public TestCompiler with(UnaryOperatorSE<TestCompiler> customizer)
      このコンパイラーにカスタマイズを適用します。
      パラメーター:
      customizer - 呼び出すカスタマイザ
      戻り値:
      カスタマイズが適用された新しい TestCompiler インスタンス
    • withSources

      public TestCompiler withSources(SourceFile... sourceFiles)
      追加のソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      sourceFiles - 追加のソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withSources

      public TestCompiler withSources(IterableSE<SourceFile> sourceFiles)
      追加のソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      sourceFiles - 追加のソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withSources

      public TestCompiler withSources(SourceFiles sourceFiles)
      追加のソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      sourceFiles - 追加のソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withResources

      public TestCompiler withResources(ResourceFile... resourceFiles)
      追加のリソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      resourceFiles - 追加のリソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withResources

      public TestCompiler withResources(IterableSE<ResourceFile> resourceFiles)
      追加のソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      resourceFiles - 追加のソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withResources

      public TestCompiler withResources(ResourceFiles resourceFiles)
      追加のリソースファイルを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      resourceFiles - 追加のリソースファイル
      戻り値:
      新しい TestCompiler インスタンス
    • withClasses

      public TestCompiler withClasses(IterableSE<ClassFile> classFiles)
      追加のクラスで新しい TestCompiler インスタンスを作成します。
      パラメーター:
      classFiles - 追加のクラス
      戻り値:
      新しい TestCompiler インスタンス
    • withProcessors

      public TestCompiler withProcessors(ProcessorSE... processors)
      追加のアノテーションプロセッサーを使用して新しい TestCompiler インスタンスを作成します。
      パラメーター:
      processors - 追加のアノテーションプロセッサー
      戻り値:
      新しい TestCompiler インスタンス
    • withProcessors

      public TestCompiler withProcessors(IterableSE<ProcessorSE> processors)
      追加のアノテーションプロセッサーを使用して新しい TestCompiler インスタンスを作成します。
      パラメーター:
      processors - 追加のアノテーションプロセッサー
      戻り値:
      新しい TestCompiler インスタンス
    • withCompilerOptions

      public TestCompiler withCompilerOptions(StringSE... options)
      追加のコンパイラーオプションを使用して、新しい TestCompiler インスタンスを作成します。
      パラメーター:
      options - 追加のコンパイラーオプション
      戻り値:
      新しい TestCompiler インスタンス
      導入:
      6.1
    • failOnWarning

      public TestCompiler failOnWarning()
      警告が発生した場合に失敗する新しい TestCompiler インスタンスを作成します。これにより、-Xlint:all および -Werror コンパイラーオプションが設定されます。
      戻り値:
      新しい TestCompiler インスタンス
      導入:
      6.1
      関連事項:
    • compile

      public void compile(WritableContent content, ConsumerSE<Compiled> compiled)
      このインスタンスのコンテンツを、提供された追加のコンテンツと共にコンパイルします。
      パラメーター:
      content - コンパイルする追加コンテンツ
      compiled - コンパイルされたコードをさらにアサートするために使用される消費
      例外:
      CompilationException - ソースをコンパイルできない場合
    • compile

      public void compile(SourceFile sourceFile, ConsumerSE<Compiled> compiled)
      このインスタンスのコンテンツを、提供された追加のソースファイルと共にコンパイルします。
      パラメーター:
      sourceFile - コンパイルする追加のソースファイル
      compiled - コンパイルされたコードをさらにアサートするために使用される消費
      例外:
      CompilationException - ソースをコンパイルできない場合
    • compile

      public void compile(SourceFiles sourceFiles, ConsumerSE<Compiled> compiled)
      このインスタンスのコンテンツを、提供された追加のソースファイルと共にコンパイルします。
      パラメーター:
      sourceFiles - コンパイルする追加のソースファイル
      compiled - コンパイルされたコードをさらにアサートするために使用される消費
      例外:
      CompilationException - ソースをコンパイルできない場合
    • compile

      public void compile(SourceFiles sourceFiles, ResourceFiles resourceFiles, ConsumerSE<Compiled> compiled)
      提供された追加のソースおよびリソースファイルとともに、このインスタンスからコンテンツをコンパイルします。
      パラメーター:
      sourceFiles - コンパイルする追加のソースファイル
      resourceFiles - 含める追加のリソースファイル
      compiled - コンパイルされたコードをさらにアサートするために使用される Consumer 
      例外:
      CompilationException - ソースをコンパイルできない場合
    • compile

      public void compile(ConsumerSE<Compiled> compiled) throws CompilationException
      このインスタンスからコンテンツをコンパイルします。
      パラメーター:
      compiled - コンパイルされたコードをさらにアサートするために使用される Consumer 
      例外:
      CompilationException - ソースをコンパイルできない場合
    • printFiles

      public TestCompiler printFiles(PrintStreamSE printStream)
      ソースファイルとリソースファイルの内容を、指定された PrintStreamSE に出力します。
      パラメーター:
      printStream - 宛先出力ストリーム
      戻り値:
      このインスタンス