#625 - Rename @DocStoreEmbedded to @DocEmbedded (with deprecation)

This commit is contained in:
Robin Bygrave
2016-03-29 15:46:10 +13:00
parent fdb2965d6e
commit 04965892f0
8 changed files with 64 additions and 41 deletions
@@ -0,0 +1,37 @@
package com.avaje.ebean.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the property is included in the parent document store index.
*
* <pre>{@code
*
*
* @DocStore
* @Entity @Table(name = "o_order")
* public class Order {
*
* ...
* // include some customer details including
* // nested billingAddress
* @DocEmbedded(doc = "id,status,name,billingAddress(*,country(*)")
* @ManyToOne
* Customer customer;
*
*
* }</pre>
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface DocEmbedded {
/**
* The properties on the embedded bean to include in the index.
*/
String doc() default "";
}
@@ -6,27 +6,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify the property is included in the parent document store index.
*
* <pre>{@code
*
*
* @DocStore
* @Entity @Table(name = "o_order")
* public class Order {
*
* ...
* // include some customer details including
* // nested billingAddress
* @DocStoreEmbedded(doc = "id,status,name,billingAddress(*,country(*)")
* @ManyToOne
* Customer customer;
*
*
* }</pre>
* Deprecated in favor of @DocEmbedded (i.e. renamed to @DocEmbedded)
*/
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Deprecated
public @interface DocStoreEmbedded {
/**
@@ -1,6 +1,5 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import com.avaje.ebean.annotation.DocStoreEmbedded;
import com.avaje.ebeaninternal.server.deploy.BeanCascadeInfo;
import com.avaje.ebeaninternal.server.deploy.BeanTable;
@@ -140,8 +139,8 @@ public abstract class DeployBeanPropertyAssoc<T> extends DeployBeanProperty {
/**
* Set DocStoreEmbedded deployment information.
*/
public void setDocStoreEmbedded(DocStoreEmbedded embedded) {
docStoreDoc = embedded.doc();
public void setDocStoreEmbedded(String embeddedDoc) {
this.docStoreDoc = embeddedDoc;
}
public String getDocStoreDoc() {
@@ -91,9 +91,13 @@ public class AnnotationFields extends AnnotationParser {
prop.setEmbedded();
}
DocEmbedded docEmbedded = get(prop, DocEmbedded.class);
if (docEmbedded != null) {
prop.setDocStoreEmbedded(docEmbedded.doc());
}
DocStoreEmbedded docStoreEmbedded = get(prop, DocStoreEmbedded.class);
if (docStoreEmbedded != null) {
prop.setDocStoreEmbedded(docStoreEmbedded);
prop.setDocStoreEmbedded(docStoreEmbedded.doc());
}
if (prop instanceof DeployBeanPropertyAssocOne<?>) {