Adding javadoc comments.
This commit is contained in:
@@ -9,10 +9,11 @@ import org.springframework.validation.FieldError;
|
||||
import org.springframework.validation.ObjectError;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* An {@link Errors} implementation for use in the events mechanism of Spring Data REST.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class ValidationErrors
|
||||
extends AbstractErrors {
|
||||
public class ValidationErrors extends AbstractErrors {
|
||||
|
||||
private String name;
|
||||
private Object entity;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Emitted after the entity is delete from the repository.
|
||||
* Emitted after the entity is deleted from the repository.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class AfterDeleteEvent
|
||||
extends RepositoryEvent {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Emitted after a link to a related object is deleted from the parent.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class AfterLinkDeleteEvent extends LinkSaveEvent {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Emitted immediately after saving a linked object to its parent in the repository.
|
||||
* Emitted after saving a linked object to its parent in the repository.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class AfterLinkSaveEvent
|
||||
extends LinkSaveEvent {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Emitted immediately after a save to the repository.
|
||||
* Emitted after a save to the repository.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class AfterSaveEvent
|
||||
extends RepositoryEvent {
|
||||
|
||||
@@ -32,10 +32,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
*/
|
||||
public class AnnotatedHandlerRepositoryEventListener
|
||||
implements ApplicationListener<RepositoryEvent>,
|
||||
ApplicationContextAware,
|
||||
InitializingBean {
|
||||
public class AnnotatedHandlerRepositoryEventListener implements ApplicationListener<RepositoryEvent>,
|
||||
ApplicationContextAware,
|
||||
InitializingBean {
|
||||
|
||||
private String basePackage;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Emitted before a link to a related object is deleted from the parent.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class BeforeLinkDeleteEvent extends LinkSaveEvent{
|
||||
public class BeforeLinkDeleteEvent extends LinkSaveEvent {
|
||||
public BeforeLinkDeleteEvent(Object source, Object linked) {
|
||||
super(source, linked);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.data.rest.repository.context;
|
||||
|
||||
/**
|
||||
* Base class for {@link RepositoryEvent}s that deal with saving a linked object.
|
||||
* Base class for {@link RepositoryEvent}s that deal with saving/updating or deleting a linked object.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public abstract class LinkSaveEvent
|
||||
extends RepositoryEvent {
|
||||
|
||||
@@ -3,10 +3,11 @@ package org.springframework.data.rest.repository.context;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* Abstract base class for events emitted by the REST exporter.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public abstract class RepositoryEvent
|
||||
extends ApplicationEvent {
|
||||
public abstract class RepositoryEvent extends ApplicationEvent {
|
||||
protected RepositoryEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.springframework.data.rest.repository.invoke;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Represents one of the CRUD methods supported by {@link org.springframework.data.repository.PagingAndSortingRepository}
|
||||
* or {@link org.springframework.data.repository.CrudRepository}.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public enum CrudMethod {
|
||||
@@ -17,6 +20,14 @@ public enum CrudMethod {
|
||||
SAVE_ONE,
|
||||
SAVE_SOME;
|
||||
|
||||
/**
|
||||
* Get an enum from a {@link Method}. Narrow down overriden methods by looking for {@link Iterable} in the first
|
||||
* parameter, which tells us it is a '_SOME' type.
|
||||
*
|
||||
* @param m
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static CrudMethod fromMethod(Method m) {
|
||||
String s = m.getName();
|
||||
Class<?>[] paramTypes = m.getParameterTypes();
|
||||
@@ -38,6 +49,11 @@ public enum CrudMethod {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn this enum into a method name.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String toMethodName() {
|
||||
switch(this) {
|
||||
case COUNT:
|
||||
|
||||
@@ -9,6 +9,9 @@ import org.codehaus.jackson.annotate.JsonProperty;
|
||||
import org.springframework.data.rest.core.Link;
|
||||
|
||||
/**
|
||||
* JSON-serializable response for returns that have a mix of results and links. Also used in responses that have just
|
||||
* links (in that case, 'results' will be an empty array).
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class RepositoryMethodResponse {
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Represents a query method on a repository interface.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
*/
|
||||
public class RepositoryQueryMethod {
|
||||
@@ -49,14 +51,29 @@ public class RepositoryQueryMethod {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The method's parameter types.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Class<?>[] paramTypes() {
|
||||
return paramTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The parameter names as pulled from the {@link Param} annotations.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String[] paramNames() {
|
||||
return paramNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link Method} to invoke.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Method method() {
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import org.springframework.data.rest.repository.AttributeMetadata;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* Implementation of {@link AttributeMetadata} for JPA.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class JpaAttributeMetadata implements AttributeMetadata {
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* Implementation of {@link EntityMetadata} for JPA.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class JpaEntityMetadata
|
||||
implements EntityMetadata<JpaAttributeMetadata> {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.springframework.data.rest.repository.RepositoryExporter;
|
||||
/**
|
||||
* Implementation of {@link RepositoryExporter} for exporting JPA {@link Repository} subinterfaces.
|
||||
*
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class JpaRepositoryExporter
|
||||
extends RepositoryExporter<JpaRepositoryMetadata, JpaEntityMetadata> {
|
||||
|
||||
@@ -20,7 +20,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
||||
* Implementation of {@link RepositoryMetadata} for JPA.
|
||||
*
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class JpaRepositoryMetadata implements RepositoryMetadata<JpaEntityMetadata> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user