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/03/01 07:48:48 UTC

[isis] branch master updated (3a14fc3 -> 47f7c70)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git.


 discard 3a14fc3  ISIS-2534: TypeIdentifier: serialization support
     new 47f7c70  ISIS-2554: TypeIdentifier: serialization support

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3a14fc3)
            \
             N -- N -- N   refs/heads/master (47f7c70)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[isis] 01/01: ISIS-2554: TypeIdentifier: serialization support

Posted by ah...@apache.org.
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

commit 47f7c7050f398d8e38000b21f68c73edc7788ec9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Mar 1 08:48:30 2021 +0100

    ISIS-2554: TypeIdentifier: serialization support
---
 .../org/apache/isis/applib/id/TypeIdentifier.java  | 34 ++++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/id/TypeIdentifier.java b/api/applib/src/main/java/org/apache/isis/applib/id/TypeIdentifier.java
index e221081..8c2f2d4 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/id/TypeIdentifier.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/id/TypeIdentifier.java
@@ -18,6 +18,10 @@
  */
 package org.apache.isis.applib.id;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Objects;
 import java.util.function.Supplier;
 
@@ -34,14 +38,23 @@ import lombok.val;
 
 /**
  * A generalization of Java's class type to also hold a logical name, which can be supplied lazily.
- * 
+ * @apiNote thread-safe and serializable
  * @since 2.0 {@index}
  */
 @ToString
-public final class TypeIdentifier implements Comparable<TypeIdentifier> {
+public final class TypeIdentifier 
+implements 
+    Comparable<TypeIdentifier>,
+    Externalizable {
 
+    /**
+     * Class this identifier represents.
+     * 
+     * @implNote in support of de-serialization cannot be declared final 
+     * (Java 15+ records will solve this issue)
+     */
     @Getter
-    private final Class<?> correspondingClass;
+    private /*final*/ Class<?> correspondingClass;
     
     @ToString.Exclude
     private final Supplier<String> logicalNameProvider;
@@ -172,6 +185,20 @@ public final class TypeIdentifier implements Comparable<TypeIdentifier> {
         return _Strings.compareNullsFirst(correspondingClass.getCanonicalName(), otherClassName);
     }
 
+    // -- SERIALIZATION
+    
+    @Override
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(getCorrespondingClass());
+        out.writeUTF(getLogicalTypeName());
+    }
+
+    @Override
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        this.correspondingClass = (Class<?>) in.readObject();
+        this.logicalName = in.readUTF();
+    }
+    
     // -- HELPER
     
     private String requireNonEmpty(final String logicalName) {
@@ -182,4 +209,5 @@ public final class TypeIdentifier implements Comparable<TypeIdentifier> {
         return logicalName;
     }
     
+    
 }