24,6 → 24,8 |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
// $Id$ |
|
import net.outlyer.plugins.Sandbox; |
import java.io.File; |
import java.io.IOException; |
176,15 → 178,26 |
execute(false, null, null); |
} |
|
public <T> T createDelayedImplementation(Class<T> c, String objectName) |
public <T> T createDelayedImplementation(final Class<T> c, |
final String objectName) |
throws PluginExecutionException { |
System.err.println("createDelayedImple"); |
final String varImpl = uniqueVarName(); |
|
final StringBuilder code = new StringBuilder(); |
|
code.append("var ").append(objectName).append(" = {\n"); |
for (final Method method : c.getMethods()) { |
if (method.getDeclaringClass() != c) { |
continue; |
} |
code.append(method.getName()).append(": null,"); |
} |
code.append("};\n"); |
|
code.append(varImpl).append(" = new ") |
.append(c.getCanonicalName()).append("(").append(objectName).append(");"); |
//System.err.println(code.toString()); |
System.err.println(code.toString()); |
|
final ScriptEngine rhino = execute(true, code.toString(), null); |
|
192,17 → 205,19 |
return (T) rhino.get(varImpl); |
} |
|
|
|
public <T> T createDelayedImplementation(Class<T> c) throws PluginExecutionException { |
public <T> T createDelayedImplementation(final Class<T> c) |
throws PluginExecutionException { |
return createDelayedImplementation(c, false); |
} |
|
public <T> T createDelayedImplementation(Class<T> c, boolean allowPartial) throws PluginExecutionException { |
public <T> T createDelayedImplementation(final Class<T> c, boolean allowPartial) |
throws PluginExecutionException { |
return createDelayedImplementation(c, null, allowPartial); |
} |
|
public <T> T createDelayedImplementation(Class<T> interfaceClass, final T fallbackObject) throws PluginExecutionException { |
public <T> T createDelayedImplementation(final Class<T> interfaceClass, |
final T fallbackObject) |
throws PluginExecutionException { |
if (null == fallbackObject) { |
throw new IllegalArgumentException("Can't use a null fallback object"); |
} |
209,7 → 224,10 |
return createDelayedImplementation(interfaceClass, fallbackObject, true); |
} |
|
private <T> T createDelayedImplementation(Class<T> c, T fallback, boolean allowPartial) throws PluginExecutionException { |
private <T> T createDelayedImplementation(final Class<T> c, |
final T fallback, |
boolean allowPartial) |
throws PluginExecutionException { |
final StringBuilder hack = new StringBuilder(); |
|
final String var = uniqueFQVarName(); |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |