type) {
this.type = type;
+ array = type.isArray();
+ }
+
+ /**
+ * Creates a new TypeData with the concrete type and type parameters around it.
+ *
+ * e.g., List<Address> would be
+ *
+ *
+ *
+ * new TypeData(Address.class, TypeData.builder(List.class).build())
+ *
+ *
+ *
+ * @param type the type
+ * @param typeParameters the parameters
+ */
+ public TypeData(Class type, TypeData>... typeParameters) {
+ this.type = type;
+ this.typeParameters.addAll(asList(typeParameters));
+ array = type.isArray();
}
/**
@@ -73,6 +95,7 @@ public TypeData(Class type) {
public TypeData(Class type, List> typeParameters) {
this.type = type;
this.typeParameters.addAll(typeParameters);
+ array = type.isArray();
}
/**
diff --git a/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterEntityModel.java b/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterEntityModel.java
index e0512fd38d6..874eeb353ec 100644
--- a/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterEntityModel.java
+++ b/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterEntityModel.java
@@ -1,23 +1,65 @@
package dev.morphia.mapping.codec.pojo.critter;
+import java.lang.annotation.Annotation;
+
import dev.morphia.annotations.Entity;
import dev.morphia.mapping.Mapper;
import dev.morphia.mapping.codec.pojo.EntityModel;
+/**
+ * 0
+ *
+ * @hidden
+ * @morphia.internal
+ */
+@SuppressWarnings("NullableProblems")
public abstract class CritterEntityModel extends EntityModel {
- private Entity entityAnnotation;
+ protected final Mapper mapper;
+ protected Entity entityAnnotation;
public CritterEntityModel(Mapper mapper, Class> type) {
- super(mapper, type);
+ super(type);
+ this.mapper = mapper;
+ }
+
+ @Override
+ public final EntityModel collectionName(String collectionName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void discriminator(String discriminator) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final EntityModel discriminatorEnabled(boolean discriminatorEnabled) {
+ throw new UnsupportedOperationException();
}
@Override
- public Entity getEntityAnnotation() {
- if (entityAnnotation == null) {
- entityAnnotation = entityAnnotation();
- }
- return entityAnnotation;
+ public final EntityModel discriminatorKey(String discriminatorKey) {
+ throw new UnsupportedOperationException();
}
- protected abstract Entity entityAnnotation();
+ @Override
+ public abstract String collectionName();
+
+ @Override
+ public abstract String discriminator();
+
+ @Override
+ public abstract String discriminatorKey();
+
+ @Override
+ public abstract boolean hasLifecycle(Class extends Annotation> type);
+
+ @Override
+ public abstract boolean isAbstract();
+
+ @Override
+ public abstract boolean isInterface();
+
+ @Override
+ public abstract boolean useDiscriminator();
}
diff --git a/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterPropertyModel.java b/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterPropertyModel.java
index 49266e65d76..6db41ef62a5 100644
--- a/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterPropertyModel.java
+++ b/core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterPropertyModel.java
@@ -19,13 +19,17 @@ public CritterPropertyModel(EntityModel entityModel) {
public abstract PropertyAccessor