-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adc104c
commit 899844c
Showing
26 changed files
with
759 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterEntityModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.morphia.mapping.codec.pojo.critter; | ||
|
||
import dev.morphia.annotations.Entity; | ||
import dev.morphia.mapping.Mapper; | ||
import dev.morphia.mapping.codec.pojo.EntityModel; | ||
|
||
public abstract class CritterEntityModel extends EntityModel { | ||
private Entity entityAnnotation; | ||
|
||
public CritterEntityModel(Mapper mapper, Class<?> type) { | ||
super(mapper, type); | ||
} | ||
|
||
@Override | ||
public Entity getEntityAnnotation() { | ||
if (entityAnnotation == null) { | ||
entityAnnotation = entityAnnotation(); | ||
} | ||
return entityAnnotation; | ||
} | ||
|
||
protected abstract Entity entityAnnotation(); | ||
} |
74 changes: 74 additions & 0 deletions
74
core/src/main/java/dev/morphia/mapping/codec/pojo/critter/CritterPropertyModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package dev.morphia.mapping.codec.pojo.critter; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.List; | ||
|
||
import dev.morphia.mapping.codec.pojo.EntityModel; | ||
import dev.morphia.mapping.codec.pojo.PropertyModel; | ||
import dev.morphia.mapping.codec.pojo.TypeData; | ||
|
||
import org.bson.codecs.pojo.PropertyAccessor; | ||
import org.bson.codecs.pojo.PropertySerialization; | ||
|
||
public abstract class CritterPropertyModel extends PropertyModel { | ||
public CritterPropertyModel(EntityModel entityModel) { | ||
super(entityModel); | ||
} | ||
|
||
@Override | ||
public abstract PropertyAccessor<Object> getAccessor(); | ||
|
||
@Override | ||
public abstract <A extends Annotation> A getAnnotation(Class<A> type); | ||
|
||
@Override | ||
public abstract List<Annotation> getAnnotations(); | ||
|
||
@Override | ||
public abstract boolean isFinal(); | ||
|
||
@Override | ||
public abstract String getFullName(); | ||
|
||
@Override | ||
public abstract List<String> getLoadNames(); | ||
|
||
@Override | ||
public abstract String getMappedName(); | ||
|
||
@Override | ||
public abstract String getName(); | ||
|
||
@Override | ||
public abstract Class<?> getNormalizedType(); | ||
|
||
@Override | ||
public abstract Class<?> getType(); | ||
|
||
@Override | ||
public abstract TypeData<?> getTypeData(); | ||
|
||
@Override | ||
public abstract boolean isArray(); | ||
|
||
@Override | ||
public abstract boolean isMap(); | ||
|
||
@Override | ||
public abstract boolean isMultipleValues(); | ||
|
||
@Override | ||
public abstract boolean isReference(); | ||
|
||
@Override | ||
public abstract boolean isScalarValue(); | ||
|
||
@Override | ||
public abstract boolean isSet(); | ||
|
||
@Override | ||
public abstract boolean isTransient(); | ||
|
||
@Override | ||
public abstract PropertyModel serialization(PropertySerialization serialization); | ||
} |
13 changes: 13 additions & 0 deletions
13
core/src/main/java/dev/morphia/mapping/conventions/MappingConvention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dev.morphia.mapping.conventions; | ||
|
||
import dev.morphia.mapping.Mapper; | ||
|
||
public interface MappingConvention<M> { | ||
/** | ||
* This method applies this Convention to the given builder | ||
* | ||
* @param mapper the mapper to use | ||
* @param model the model to apply the convention to | ||
*/ | ||
void apply(Mapper mapper, M model); | ||
} |
10 changes: 1 addition & 9 deletions
10
core/src/main/java/dev/morphia/mapping/conventions/MorphiaConvention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
package dev.morphia.mapping.conventions; | ||
|
||
import dev.morphia.mapping.Mapper; | ||
import dev.morphia.mapping.codec.pojo.EntityModel; | ||
|
||
/** | ||
* Applies certain conventions specific for Morphia | ||
*/ | ||
public interface MorphiaConvention { | ||
/** | ||
* This method applies this Convention to the given builder | ||
* | ||
* @param mapper | ||
* @param builder the builder to apply the convention to | ||
*/ | ||
void apply(Mapper mapper, EntityModel builder); | ||
public interface MorphiaConvention extends MappingConvention<EntityModel> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.