You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/12/20 08:01:45 UTC
[isis] branch master updated: ISIS-2882: [Demo] add primitive standalone collection demos
This is an automated email from the ASF dual-hosted git repository.
ahuber 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 f7dd467 ISIS-2882: [Demo] add primitive standalone collection demos
f7dd467 is described below
commit f7dd46736248996e7951c9da8d519c72904142fc
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Dec 20 09:01:36 2021 +0100
ISIS-2882: [Demo] add primitive standalone collection demos
- based on arrays (showing we can do arrays as well)
---
...rimitiveBooleanHolder_actionReturningArray.java | 51 +++++++++++++++++++++
.../PrimitiveByteHolder_actionReturningArray.java | 51 +++++++++++++++++++++
.../PrimitiveCharHolder_actionReturningArray.java | 51 +++++++++++++++++++++
...PrimitiveDoubleHolder_actionReturningArray.java | 51 +++++++++++++++++++++
.../PrimitiveFloatHolder_actionReturningArray.java | 51 +++++++++++++++++++++
.../PrimitiveIntHolder_actionReturningArray.java | 51 +++++++++++++++++++++
.../PrimitiveLongHolder_actionReturningArray.java | 52 ++++++++++++++++++++++
.../PrimitiveShortHolder_actionReturningArray.java | 51 +++++++++++++++++++++
8 files changed, 409 insertions(+)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/holder/PrimitiveBooleanHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/holder/PrimitiveBooleanHolder_actionReturningArray.java
new file mode 100644
index 0000000..7082ddf
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/holder/PrimitiveBooleanHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.booleans.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveBooleanHolder_actionReturningArray {
+
+ private final PrimitiveBooleanHolder holder;
+
+ public boolean[] act() {
+ val array = new boolean[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Boolean> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/holder/PrimitiveByteHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/holder/PrimitiveByteHolder_actionReturningArray.java
new file mode 100644
index 0000000..1566caf
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/holder/PrimitiveByteHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.bytes.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveByteHolder_actionReturningArray {
+
+ private final PrimitiveByteHolder holder;
+
+ public byte[] act() {
+ val array = new byte[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Byte> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/holder/PrimitiveCharHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/holder/PrimitiveCharHolder_actionReturningArray.java
new file mode 100644
index 0000000..aa496b2
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/holder/PrimitiveCharHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.chars.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveCharHolder_actionReturningArray {
+
+ private final PrimitiveCharHolder holder;
+
+ public char[] act() {
+ val array = new char[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Character> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/holder/PrimitiveDoubleHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/holder/PrimitiveDoubleHolder_actionReturningArray.java
new file mode 100644
index 0000000..62c68b1
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/holder/PrimitiveDoubleHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.doubles.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveDoubleHolder_actionReturningArray {
+
+ private final PrimitiveDoubleHolder holder;
+
+ public double[] act() {
+ val array = new double[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Double> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/holder/PrimitiveFloatHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/holder/PrimitiveFloatHolder_actionReturningArray.java
new file mode 100644
index 0000000..c137d4d
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/holder/PrimitiveFloatHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.floats.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveFloatHolder_actionReturningArray {
+
+ private final PrimitiveFloatHolder holder;
+
+ public float[] act() {
+ val array = new float[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Float> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/holder/PrimitiveIntHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/holder/PrimitiveIntHolder_actionReturningArray.java
new file mode 100644
index 0000000..f8563e3
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/holder/PrimitiveIntHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.ints.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveIntHolder_actionReturningArray {
+
+ private final PrimitiveIntHolder holder;
+
+ public int[] act() {
+ val array = new int[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Integer> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/holder/PrimitiveLongHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/holder/PrimitiveLongHolder_actionReturningArray.java
new file mode 100644
index 0000000..619c15c
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/holder/PrimitiveLongHolder_actionReturningArray.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.longs.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveLongHolder_actionReturningArray {
+
+ private final PrimitiveLongHolder holder;
+
+ public long[] act() {
+ val array = new long[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Long> samples;
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/holder/PrimitiveShortHolder_actionReturningArray.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/holder/PrimitiveShortHolder_actionReturningArray.java
new file mode 100644
index 0000000..eaa04fe
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/holder/PrimitiveShortHolder_actionReturningArray.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.types.primitive.shorts.holder;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.commons.functional.IndexedConsumer;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import demoapp.dom.types.Samples;
+
+@SuppressWarnings("unused")
+//tag::class[]
+@Action(semantics = SemanticsOf.SAFE)
+@RequiredArgsConstructor
+public class PrimitiveShortHolder_actionReturningArray {
+
+ private final PrimitiveShortHolder holder;
+
+ public short[] act() {
+ val array = new short[(int)samples.stream().count()];
+ samples.stream()
+ .forEach(IndexedConsumer.zeroBased((index, value)->array[index] = value));
+ return array;
+ }
+
+ @Inject
+ Samples<Short> samples;
+
+}
+//end::class[]