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/12/21 17:38:29 UTC
[isis] 01/03: ISIS-1782: adds in
ModuleAbstract#getModuleDependencies so can serialize out as XML
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
commit 0fa4bcbd564ef7f0e76f8adc8d32d7f0271d5ef2
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Dec 21 14:50:13 2017 +0000
ISIS-1782: adds in ModuleAbstract#getModuleDependencies so can serialize out as XML
---
.../org/apache/isis/applib/ModuleAbstract.java | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/core/applib/src/main/java/org/apache/isis/applib/ModuleAbstract.java b/core/applib/src/main/java/org/apache/isis/applib/ModuleAbstract.java
index 44a2284..61f1dc9 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/ModuleAbstract.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/ModuleAbstract.java
@@ -18,13 +18,19 @@
*/
package org.apache.isis.applib;
-import java.util.Collections;
import java.util.Objects;
import java.util.Set;
+import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Sets;
+
import org.apache.isis.applib.fixturescripts.FixtureScript;
/**
@@ -42,7 +48,25 @@ public abstract class ModuleAbstract
@Override
@XmlTransient
public Set<Module> getDependencies() {
- return Collections.emptySet();
+ return Sets.newLinkedHashSet();
+ }
+
+ @XmlElement(name = "module", required = true)
+ private Set<ModuleAbstract> getModuleDependencies() {
+ return FluentIterable.from(getDependencies())
+ .filter(new Predicate<Module>() {
+ @Override
+ public boolean apply(@Nullable final Module module) {
+ return module instanceof ModuleAbstract;
+ }
+ })
+ .transform(new Function<Module, ModuleAbstract>() {
+ @Nullable @Override
+ public ModuleAbstract apply(@Nullable final Module module) {
+ return (ModuleAbstract) module;
+ }
+ })
+ .toSet();
}
/**
--
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.