forked from ebean-orm/ebean
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR ebean-orm#3143 - FEATURE: DbJson Support for Dto-Queries
- Loading branch information
Showing
9 changed files
with
325 additions
and
19 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
53 changes: 53 additions & 0 deletions
53
ebean-core/src/main/java/io/ebeaninternal/server/deploy/meta/DeployProperty.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,53 @@ | ||
package io.ebeaninternal.server.deploy.meta; | ||
|
||
import io.ebean.annotation.MutationDetection; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
import java.util.List; | ||
|
||
/** | ||
* Property, with basic type information (BeanProperty and DtoProperty). | ||
*/ | ||
public interface DeployProperty { | ||
|
||
/** | ||
* Return the name of the property. | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* Return the generic type for this property. | ||
*/ | ||
Type getGenericType(); | ||
|
||
/** | ||
* Return the property type. | ||
*/ | ||
Class<?> getPropertyType(); | ||
|
||
/** | ||
* Returns the owner class of this property. | ||
*/ | ||
Class<?> getOwnerType(); | ||
|
||
/** | ||
* Returns the annotations on this property. | ||
*/ | ||
<A extends Annotation> List<A> getMetaAnnotations(Class<A> annotationType); | ||
|
||
/** | ||
* Returns the mutation detection setting of this property. | ||
*/ | ||
MutationDetection getMutationDetection(); | ||
|
||
/** | ||
* Sets the mutation detection setting of this property. | ||
*/ | ||
void setMutationDetection(MutationDetection mutationDetection); | ||
|
||
/** | ||
* Return true if this property is not mandatory. | ||
*/ | ||
boolean isNullable(); | ||
} |
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
81 changes: 81 additions & 0 deletions
81
ebean-core/src/main/java/io/ebeaninternal/server/dto/DtoMetaDeployProperty.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,81 @@ | ||
package io.ebeaninternal.server.dto; | ||
|
||
import io.ebean.annotation.MutationDetection; | ||
import io.ebeaninternal.server.deploy.meta.DeployProperty; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Type; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* DeployProperty for Dto-Properties. | ||
* | ||
* @author Roland Praml, FOCONIS AG | ||
*/ | ||
class DtoMetaDeployProperty implements DeployProperty { | ||
private final String name; | ||
private final Class<?> ownerType; | ||
private final Type genericType; | ||
private final Class<?> propertyType; | ||
private final Set<Annotation> metaAnnotations; | ||
private final boolean nullable; | ||
private MutationDetection mutationDetection = MutationDetection.DEFAULT; | ||
|
||
DtoMetaDeployProperty(String name, Class<?> ownerType, Type genericType, Class<?> propertyType, Set<Annotation> metaAnnotations, Method method) { | ||
this.name = name; | ||
this.ownerType = ownerType; | ||
this.genericType = genericType; | ||
this.nullable = !propertyType.isPrimitive(); | ||
this.propertyType = propertyType; | ||
this.metaAnnotations = metaAnnotations; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public Type getGenericType() { | ||
return genericType; | ||
} | ||
|
||
@Override | ||
public Class<?> getPropertyType() { | ||
return propertyType; | ||
} | ||
|
||
@Override | ||
public Class<?> getOwnerType() { | ||
return ownerType; | ||
} | ||
|
||
@Override | ||
public <A extends Annotation> List<A> getMetaAnnotations(Class<A> annotationType) { | ||
List<A> result = new ArrayList<>(); | ||
for (Annotation ann : metaAnnotations) { | ||
if (ann.annotationType() == annotationType) { | ||
result.add((A) ann); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
@Override | ||
public MutationDetection getMutationDetection() { | ||
return mutationDetection; | ||
} | ||
|
||
@Override | ||
public void setMutationDetection(MutationDetection mutationDetection) { | ||
this.mutationDetection = mutationDetection; | ||
} | ||
|
||
@Override | ||
public boolean isNullable() { | ||
return nullable; | ||
} | ||
} |
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.