Skip to content

Commit 1313904

Browse files
committed
Abolish :type metadata
1 parent a314e61 commit 1313904

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

src/main/java/com/github/rschmitt/dynamicobject/internal/DynamicObjectInstance.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ private D diff(D arg, int idx) {
9696
Object array = ClojureStuff.Diff.invoke(map, arg.getMap());
9797
Object union = ClojureStuff.Nth.invoke(array, idx);
9898
if (union == null) union = ClojureStuff.EmptyMap;
99-
union = Metadata.withTypeMetadata(union, type);
10099
return DynamicObject.wrap((Map) union, type);
101100
}
102101

src/main/java/com/github/rschmitt/dynamicobject/internal/Instances.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Instances {
1414
private static final ConcurrentMap<Class, DynamicProxy> proxyCache = new ConcurrentHashMap<>();
1515

1616
public static <D extends DynamicObject<D>> D newInstance(Class<D> type) {
17-
return wrap((Map) Metadata.withTypeMetadata(EmptyMap, type), type);
17+
return wrap(EmptyMap, type);
1818
}
1919

2020
@SuppressWarnings("unchecked")
@@ -23,10 +23,6 @@ public static <T> T wrap(Map map, Class<T> type) {
2323
throw new NullPointerException("A null reference cannot be used as a DynamicObject");
2424
if (map instanceof DynamicObject)
2525
return type.cast(map);
26-
Class<?> typeMetadata = Metadata.getTypeMetadata(map);
27-
if (typeMetadata != null && !type.equals(typeMetadata))
28-
throw new ClassCastException(String.format("Attempted to wrap a map tagged as %s in type %s",
29-
typeMetadata.getSimpleName(), type.getSimpleName()));
3026

3127
return createIndyProxy(map, type);
3228
}

src/main/java/com/github/rschmitt/dynamicobject/internal/Metadata.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/java/com/github/rschmitt/dynamicobject/internal/RecordReader.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public final class RecordReader<D extends DynamicObject<D>> extends AFn {
1818
*/
1919
@Override
2020
public Object invoke(Object map) {
21-
Object mapWithMeta = Metadata.withTypeMetadata(map, type);
22-
return DynamicObject.wrap((Map) mapWithMeta, type);
21+
return DynamicObject.wrap((Map) map, type);
2322
}
2423
}

0 commit comments

Comments
 (0)