var Api = require('./api');
module.exports.view = function(){
var api = Api();
var setupEmbeddedView = function setupEmbeddedView(url, tmpl) {
tmpls.renderExtTemplate({
name: tmpl,
selector: targetDiv,
data: {
url: url,
width: iframeTargetDiv.width(),
height: iframeTargetDiv.height()
},
callback: function() {
jQuery('#taskFormFrame').load(function(e) {
console.log("taskFormFrame load fired!");
});
}
});
},
showCurrentTaskForm = function showCurrentTaskForm() {
console.log("mark");
api.getCurrentProcessInstanceTask({
callback: function(tasks) {
setupEmbeddedView(getTaskFormUrl(tasks), 'showTaskForm');
}
});
}
return {
showCurrentTaskForm: showCurrentTaskForm
}
}
我们可以在界面中实现上面的方法, 或者我们必须在界面中定义方法。
答案 0 :(得分:7)
是的,你可以在Java 8中使用默认方法
interface temp
{
default public int add(int a,int b)
{
return a+b;
}
}
正如Thilo在评论中所提到的,Java 8还增加了在接口中使用静态方法的可能性:
interface temp
{
public static int add(int a,int b)
{
return a+b;
}
}
答案 1 :(得分:0)
如果您没有使用12:01:24 [INFO] --- maven-surefire-plugin:2.16:test (integration-test) @ apm-tests ---
12:01:32 [INFO] No tests to run.
,那么您只能在界面中定义方法。
<parent>
<artifactId>apm-root</artifactId>
<groupId>com.platform</groupId>
<version>12.50.9999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apm-tests</artifactId>
<packaging>pom</packaging>
<dependencies>
<dependency>
</dependency>
</dependencies>
<profile>
<id>generate-schema</id>
<build>
<plugins>
<plugin>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>start-jetty</id>
<build>
<plugins>
<plugin>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skipTests>false</skipTests>
<argLine>-Xmx1536m</argLine>
<testSourceDirectory>path_to_tests(2nd pom)</testSourceDirectory>
<includes>
<include>path_to_tests/**/*.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
这是java 8
中引入的新功能“界面中的默认方法”。