diff --git a/core/src/main/java/com/ibm/common/activitystreams/Collection.java b/core/src/main/java/com/ibm/common/activitystreams/Collection.java
index 8d48025..83abf21 100755
--- a/core/src/main/java/com/ibm/common/activitystreams/Collection.java
+++ b/core/src/main/java/com/ibm/common/activitystreams/Collection.java
@@ -164,13 +164,28 @@ public class Collection
**/
protected abstract A create();
+ @Override
+ public B set(String key, Object value) {
+ if (key.equals("items")) {
+ if (value instanceof ArrayLinkValue) {
+ ArrayLinkValue alv = (ArrayLinkValue) value;
+ for (LinkValue lv : alv) {
+ list.add((ASObject)lv);
+ }
+ } else if (value instanceof ASObject)
+ list.add((ASObject) value);
+ return (B)this;
+ } else return super.set(key,value);
+ }
+
+
/**
* Method get.
* @return A
* @see com.google.common.base.Supplier#get()
**/
public A get() {
- set("items", list.build());
+ super.set("items", list.build());
return create();
}
diff --git a/core/src/main/java/com/ibm/common/activitystreams/TypeValue.java b/core/src/main/java/com/ibm/common/activitystreams/TypeValue.java
index a02fd69..dffcfc6 100755
--- a/core/src/main/java/com/ibm/common/activitystreams/TypeValue.java
+++ b/core/src/main/java/com/ibm/common/activitystreams/TypeValue.java
@@ -22,6 +22,8 @@
package com.ibm.common.activitystreams;
import java.io.Serializable;
+import java.util.Objects;
+
import com.ibm.common.activitystreams.util.AbstractWritable;
/**
@@ -122,7 +124,24 @@ public interface TypeValue
super(builder);
this.iri = builder.iri;
}
-
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(iri);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SimpleTypeValue other = (SimpleTypeValue) obj;
+ return Objects.equals(iri,other.iri);
+ }
+
/**
* Return the type value identifier
* @return String
diff --git a/core/src/main/java/com/ibm/common/activitystreams/internal/ASObjectAdapter.java b/core/src/main/java/com/ibm/common/activitystreams/internal/ASObjectAdapter.java
index 651eb64..348fe79 100755
--- a/core/src/main/java/com/ibm/common/activitystreams/internal/ASObjectAdapter.java
+++ b/core/src/main/java/com/ibm/common/activitystreams/internal/ASObjectAdapter.java
@@ -223,7 +223,7 @@ public class ASObjectAdapter
_class != null ?
context.deserialize(val,_class) :
primConverter.convert(val.getAsJsonPrimitive()));
- else if (val.isJsonArray())
+ else if (val.isJsonArray()) {
builder.set(
name,
LinkValue.class.isAssignableFrom(_class!=null?_class:Object.class) ?
@@ -233,7 +233,7 @@ public class ASObjectAdapter
_class,
context,
builder()));
- else if (val.isJsonObject())
+ } else if (val.isJsonObject())
builder.set(
name,
context.deserialize(
diff --git a/typext/pom.xml b/typext/pom.xml
index 80fdf66..9966778 100644
--- a/typext/pom.xml
+++ b/typext/pom.xml
@@ -149,5 +149,9 @@
4.3.3
pom
+
+ junit
+ junit
+
\ No newline at end of file
diff --git a/typext/src/main/java/com/ibm/common/activitystreams/registry/CachingResolutionStrategy.java b/typext/src/main/java/com/ibm/common/activitystreams/registry/CachingResolutionStrategy.java
index be4d7bf..ff4455b 100644
--- a/typext/src/main/java/com/ibm/common/activitystreams/registry/CachingResolutionStrategy.java
+++ b/typext/src/main/java/com/ibm/common/activitystreams/registry/CachingResolutionStrategy.java
@@ -110,9 +110,18 @@ public abstract class CachingResolutionStrategy
this.cache = cache;
}
- public void receive(TypeValue t) {
- if (t.valueType() == ValueType.OBJECT && t.id() != null)
- cache.put(Makers.type(t.id()),t);
+ public void receive(final TypeValue t) {
+ if (t.valueType() == ValueType.OBJECT && t.id() != null) {
+ final TypeValue tv = Makers.type(t.id());
+ cache.invalidate(tv);
+ try {
+ TypeValue tt = cache.get(tv, new Callable() {
+ public TypeValue call() {
+ return t;
+ }
+ });
+ } catch (Throwable e) {}
+ }
}
}
diff --git a/typext/src/main/java/com/ibm/common/activitystreams/registry/TypeValueRegistry.java b/typext/src/main/java/com/ibm/common/activitystreams/registry/TypeValueRegistry.java
index c7daa80..e829e30 100644
--- a/typext/src/main/java/com/ibm/common/activitystreams/registry/TypeValueRegistry.java
+++ b/typext/src/main/java/com/ibm/common/activitystreams/registry/TypeValueRegistry.java
@@ -22,6 +22,7 @@ import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.Monitor;
import com.ibm.common.activitystreams.IO;
+import com.ibm.common.activitystreams.Makers;
import com.ibm.common.activitystreams.TypeValue;
import com.ibm.common.activitystreams.ValueType;
import com.ibm.common.activitystreams.ext.ExtModule;
@@ -165,11 +166,21 @@ public final class TypeValueRegistry
future,
new FutureCallback