You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/11/29 17:15:18 UTC
[isis] branch master updated: ISIS-1784: extends
BuilderScriptAbstract further,
with new set(...) method to allow prereqs to be run within the execute
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 680569c ISIS-1784: extends BuilderScriptAbstract further, with new set(...) method to allow prereqs to be run within the execute
680569c is described below
commit 680569c4e7c91e5cde6a8ec8a7a2d204bd5b72cf
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Nov 29 17:15:09 2017 +0000
ISIS-1784: extends BuilderScriptAbstract further, with new set(...) method to allow prereqs to be run within the execute
---
.../fixturescripts/BuilderScriptAbstract.java | 28 +++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/BuilderScriptAbstract.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/BuilderScriptAbstract.java
index 4a720a5..3b7078e 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/BuilderScriptAbstract.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/BuilderScriptAbstract.java
@@ -18,6 +18,10 @@
*/
package org.apache.isis.applib.fixturescripts;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
import org.apache.isis.applib.annotation.Programmatic;
public abstract class BuilderScriptAbstract<T,F extends BuilderScriptAbstract<T,F>>
@@ -51,9 +55,22 @@ public abstract class BuilderScriptAbstract<T,F extends BuilderScriptAbstract<T,
return (F)executionContext.executeChildT(parentFixtureScript, this);
}
+ @Override
+ protected final void execute(final ExecutionContext executionContext) {
+
+ final F onFixture = (F) BuilderScriptAbstract.this;
+ for (final Block<T,F> prereq : prereqs) {
+ prereq.execute(onFixture, executionContext);
+ }
+
+ doExecute(executionContext);
+ }
+
+ protected abstract void doExecute(final ExecutionContext executionContext);
+
public abstract T getObject();
- protected <E extends EnumWithBuilderScript<T, F>, T, F extends BuilderScriptAbstract<T,F>> T objectFor(
+ public <E extends EnumWithBuilderScript<T, F>, T, F extends BuilderScriptAbstract<T,F>> T objectFor(
final E datum,
final FixtureScript.ExecutionContext ec) {
if(datum == null) {
@@ -63,6 +80,15 @@ public abstract class BuilderScriptAbstract<T,F extends BuilderScriptAbstract<T,
return ec.executeChildT(this, fixtureScript).getObject();
}
+ private final List<Block> prereqs = Lists.newArrayList();
+ public F set(Block<T,F> prereq) {
+ prereqs.add(prereq);
+ return (F)this;
+ }
+
+ public interface Block<T,F extends BuilderScriptAbstract<T,F>> {
+ void execute(final F onFixture, final ExecutionContext executionContext);
+ }
}
--
To stop receiving notification emails like this one, please contact
['"commits@isis.apache.org" <co...@isis.apache.org>'].