DATACMNS-124 - Added missing package-info.java files.

Polished JavaDocs. Polished MappingContextEvent and added deprecations to it to be cleaned up for 1.3.GA.
This commit is contained in:
Oliver Gierke
2012-01-23 11:26:39 +01:00
parent 5c248983d2
commit b811fa3ea8
25 changed files with 180 additions and 21 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.annotation;
import java.lang.annotation.ElementType;
@@ -22,7 +21,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Jon Brisbin <jbrisbin@vmware.com>
* Meta-annotation to be used to annotate annotations that mark references to other objects.
*
* @author Oliver Gierke
* @author Jon Brisbin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.ANNOTATION_TYPE, ElementType.FIELD })

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 20011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.annotation;
import java.lang.annotation.ElementType;
@@ -22,7 +21,11 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author J. Brisbin <jbrisbin@vmware.com>
* Marks a field to be transient for the mapping framework. Thus the property will not be persisted and not further
* inspected by the mapping framework.
*
* @author Oliver Gierke
* @author Jon Brisbin
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)

View File

@@ -0,0 +1,4 @@
/**
* Core annotations being used by Spring Data.
*/
package org.springframework.data.annotation;

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,

View File

@@ -0,0 +1,4 @@
/**
* Types to abstract authentication concepts.
*/
package org.springframework.data.authentication;

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,6 +21,8 @@ import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.MappingContext;
/**
* Combined {@link EntityReader} and {@link EntityWriter} and add the ability to access a {@link MappingContext} and
* {@link ConversionService}.
*
* @param <E> the concrete {@link PersistentEntity} implementation the converter is based on.
* @param <P> the concrete {@link PersistentProperty} implementation the converter is based on.
@@ -44,5 +46,4 @@ public interface EntityConverter<E extends PersistentEntity<?, P>, P extends Per
* @return never {@literal null}.
*/
ConversionService getConversionService();
}

View File

@@ -0,0 +1,6 @@
/**
* General purpose conversion framework to read objects from a data store abstraction and write it back.
*
* @see org.springframework.data.convert.EntityConverter
*/
package org.springframework.data.convert;

View File

@@ -0,0 +1,4 @@
/**
* Support for cross-store persistence.
*/
package org.springframework.data.crossstore;

View File

@@ -0,0 +1,5 @@
/**
* Basic interfaces and value objects for historiography API.
*/
package org.springframework.data.history;

View File

@@ -0,0 +1,4 @@
/**
* Mapping context API and implementation base classes.
*/
package org.springframework.data.mapping.context;

View File

@@ -1,11 +1,11 @@
/*
* Copyright (c) 2011 by the original author(s).
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,34 +13,77 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mapping.event;
import org.springframework.context.ApplicationEvent;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.util.TypeInformation;
import org.springframework.util.Assert;
/**
* @author Jon Brisbin <jbrisbin@vmware.com>
* Base implementation of an {@link ApplicationEvent} refering to a {@link PersistentEntity}.
*
* @author Oliver Gierke
* @author Jon Brisbin
* @param <E> the {@link PersistentEntity} the context was created for
* @param <P> the {@link PersistentProperty} the {@link PersistentEntity} consists of
*/
public class MappingContextEvent<E extends PersistentEntity<?, P>, P extends PersistentProperty<P>> extends
ApplicationEvent {
private static final long serialVersionUID = 1336466833846092490L;
private TypeInformation<?> typeInformation;
private final TypeInformation<?> typeInformation;
private final E source;
/**
* Creates a new {@link MappingContextEvent} for the given {@link PersistentEntity}.
*
* @param source must not be {@literal null}.
*/
@SuppressWarnings("deprecation")
public MappingContextEvent(E source) {
this(source, source.getTypeInformation());
}
/**
* Creates a new {@link MappingContextEvent} for the given {@link PersistentEntity} and {@link TypeInformation}.
*
* @deprecated use {@link #MappingContextEvent(PersistentEntity)} instead. Will be removed for 1.3.GA.
* @param source must not be {@literal null}.
* @param typeInformation must not be {@literal null}.
*/
@Deprecated
public MappingContextEvent(E source, TypeInformation<?> typeInformation) {
super(source);
Assert.notNull(source);
Assert.notNull(typeInformation);
this.source = source;
this.typeInformation = typeInformation;
}
/**
* The {@link TypeInformation} the event was created for (usually the one derived from the underlying
* {@link PersistentEntity}).
*
* @deprecated use the {@link TypeInformation} available from {@link #getPersistentEntity()} instead. Will be removed
* for 1.3.GA.
* @return
*/
@Deprecated
public TypeInformation<?> getTypeInformation() {
return typeInformation;
}
@SuppressWarnings("unchecked")
/**
* Returns the {@link PersistentEntity} the event was created for.
*
* @return
*/
public E getPersistentEntity() {
return (E) source;
return source;
}
}

View File

@@ -0,0 +1,4 @@
/**
*
*/
package org.springframework.data.mapping.event;

View File

@@ -0,0 +1,4 @@
/**
* Core implementation of the mapping subsystem's model.
*/
package org.springframework.data.mapping.model;

View File

@@ -0,0 +1,4 @@
/**
* Base package for the mapping subsystem.
*/
package org.springframework.data.mapping;

View File

@@ -0,0 +1,6 @@
/**
* Deprecated entity instantiation API.
*
* @deprecated Use entity instantation API around {@link org.springframework.data.convert.EntityInstantiator} instead.
*/
package org.springframework.data.persistence;

View File

@@ -0,0 +1,6 @@
/**
* Querydsl integration support classes.
*
* @see http://www.querydsl.com
*/
package org.springframework.data.querydsl;

View File

@@ -0,0 +1,5 @@
/**
* Base classes to implement CDI support for repositories.
*/
package org.springframework.data.repository.cdi;

View File

@@ -0,0 +1,5 @@
/**
* Core abstractions for repository implementation.
*/
package org.springframework.data.repository.core;

View File

@@ -0,0 +1,5 @@
/**
* API for repositories using historiography.
*/
package org.springframework.data.repository.history;

View File

@@ -0,0 +1,5 @@
/**
* Value objects to implement core repository interfaces for historiography.
*/
package org.springframework.data.repository.history.support;

View File

@@ -0,0 +1,4 @@
/**
* Support classes for integration of the repository programming model with 3rd party frameworks.
*/
package org.springframework.data.repository.support;

View File

@@ -0,0 +1,4 @@
/**
* Core utility APIs such as a type information framework to resolve generic types.
*/
package org.springframework.data.util;

View File

@@ -0,0 +1,4 @@
/**
* Integration with Spring MVC.
*/
package org.springframework.data.web;

View File

@@ -1,7 +1,7 @@
package org.springframework.data.mapping.model;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
@@ -54,6 +54,30 @@ public class AbstractPersistentPropertyUnitTests {
assertThat(property.getPersistentEntityType().iterator().hasNext(), is(false));
}
@Test
public void foo() {
Field field1 = ReflectionUtils.findField(Bar1.class, "field");
Field field2 = ReflectionUtils.findField(Bar2.class, "field");
assertThat(field1, is(field2));
System.out.println(field1.getType());
System.out.println(ClassTypeInformation.from(Bar1.class).getProperty("field").getType());
System.out.println(ClassTypeInformation.from(Bar2.class).getProperty("field").getType());
}
class Foo<T> {
T field;
}
class Bar1 extends Foo<String> {
}
class Bar2 extends Foo<Object> {
}
@SuppressWarnings("serial")
class TestClassSet extends TreeSet<Object> {
}

View File

@@ -210,6 +210,9 @@
<repository>
<id>spring-libs-release</id>
<url>http://repo.springsource.org/libs-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<reporting>