StandardScriptFactory )@DeprecatedSE public class JRubyScriptFactory extends ObjectSE implements ScriptFactory, BeanClassLoaderAware
ScriptFactory 実装。 通常、ScriptFactoryPostProcessor と組み合わせて使用されます。設定例については、後者の javadoc を参照してください。
メモ: Spring 4.0 は JRuby 1.5 以上をサポートしており、1.7.x が推奨されています。Spring 4.2 では、JRuby 9.0.0.0 もサポートされていますが、主に StandardScriptFactory を通じてサポートされています。
JRubyScriptUtils, ScriptFactoryPostProcessor| コンストラクターと説明 |
|---|
JRubyScriptFactory(StringSE scriptSourceLocator, ClassSE<?>... scriptInterfaces) 使用すべきではありません。 指定されたスクリプトソースに対して新しい JRubyScriptFactory を作成します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
ObjectSE | getScriptedObject(ScriptSource scriptSource, ClassSE<?>... actualInterfaces) 使用すべきではありません。 JRubyScriptUtils を介して JRuby スクリプトを読み込み、解析します。 |
ClassSE<?> | getScriptedObjectType(ScriptSource scriptSource) 使用すべきではありません。 スクリプト Java オブジェクトの型を判別します。 |
ClassSE<?>[] | getScriptInterfaces() 使用すべきではありません。 スクリプトが実装することになっているビジネスインターフェースを返します。 |
StringSE | getScriptSourceLocator() 使用すべきではありません。 スクリプトのソースを指すロケーターを返します。 |
boolean | requiresConfigInterface() 使用すべきではありません。 JRuby スクリプトには設定インターフェースが必要です。 |
boolean | requiresScriptedObjectRefresh(ScriptSource scriptSource) 使用すべきではありません。 リフレッシュが必要かどうかを判断します(例: |
void | setBeanClassLoader(ClassLoaderSE classLoader) 使用すべきではありません。 Bean class loaderSE を Bean インスタンスに提供するコールバック。 |
StringSE | toString() 使用すべきではありません。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEpublic JRubyScriptFactory(StringSE scriptSourceLocator, ClassSE<?>... scriptInterfaces)
scriptSourceLocator - スクリプトのソースを指すロケーター。実際にスクリプトを作成するポストプロセッサーによって解釈されます。scriptInterfaces - スクリプトオブジェクトが実装することになっている Java インターフェース public void setBeanClassLoader(ClassLoaderSE classLoader)
BeanClassLoaderAwareclass loaderSE を Bean インスタンスに提供するコールバック。 通常の Bean プロパティの設定後、ただし InitializingBean's InitializingBean.afterPropertiesSet() メソッドやカスタム init-method などの初期化コールバックの前に呼び出されます。
BeanClassLoaderAware の setBeanClassLoader classLoader - 所有クラスローダー。null の場合もありますが、その場合はデフォルトの ClassLoader を使用する必要があります。たとえば、ClassUtils.getDefaultClassLoader() 経由で取得した ClassLoader などです。public StringSE getScriptSourceLocator()
ScriptFactoryサポートされている一般的なロケータは、Spring リソースの場所 ( "file:C:/myScript.bsh"" や "classpath:myPackage/myScript.bsh" など) とインラインスクリプト ( "inline:myScriptText..." ) です。
public ClassSE<?>[] getScriptInterfaces()
ScriptFactory スクリプト自体がその Java インターフェースを決定する場合(Groovy の場合など)、null を返すことができます。
ScriptFactory の getScriptInterfaces public boolean requiresConfigInterface()
ScriptFactory の requiresConfigInterface ScriptFactory.getScriptInterfaces()public ObjectSE getScriptedObject(ScriptSource scriptSource, ClassSE<?>... actualInterfaces) throws IOExceptionSE, ScriptCompilationException
ScriptFactory の getScriptedObject scriptSource - スクリプトソーステキストを取得する実際の ScriptSource (非 null)actualInterfaces - スクリプトインターフェースと生成された設定インターフェースを含む、公開する実際のインターフェース (該当する場合 ; null の可能性があります)IOExceptionSE - スクリプトの取得に失敗した場合 ScriptCompilationException - スクリプトのコンパイルが失敗した場合 JRubyScriptUtils.createJRubyObject(String, Class[], ClassLoader)public ClassSE<?> getScriptedObjectType(ScriptSource scriptSource) throws IOExceptionSE, ScriptCompilationException
ScriptFactory実装では、生成されたスクリプトクラスなどのスクリプトメタデータをキャッシュすることをお勧めします。このメソッドは同時に呼び出すことができ、スレッドセーフな方法で実装する必要があることに注意してください。
ScriptFactory の getScriptedObjectType scriptSource - スクリプトソーステキストを取得する実際の ScriptSource (非 null)null IOExceptionSE - スクリプトの取得に失敗した場合 ScriptCompilationException - スクリプトのコンパイルが失敗した場合 public boolean requiresScriptedObjectRefresh(ScriptSource scriptSource)
ScriptFactoryisModified() メソッドなどを使用)。ScriptFactory の requiresScriptedObjectRefresh scriptSource - スクリプトソーステキストを取得する実際の ScriptSource (非 null)ScriptFactory.getScriptedObject(org.springframework.scripting.ScriptSource, java.lang.Class<?>...) 呼び出しが必要かどうか ScriptSource.isModified()public StringSE toString()
ObjectSE の toStringSE