diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java b/spring-data-commons-core/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java index f400e9330..87eca65eb 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/convert/DefaultTypeMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2011-2013 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. @@ -88,7 +88,7 @@ public class DefaultTypeMapper implements TypeMapper { /* * (non-Javadoc) - * @see org.springframework.data.mongodb.core.convert.MongoTypeMapper#readType(com.mongodb.DBObject) + * @see org.springframework.data.convert.TypeMapper#readType(java.lang.Object) */ public TypeInformation readType(S source) { @@ -159,7 +159,7 @@ public class DefaultTypeMapper implements TypeMapper { /* * (non-Javadoc) - * @see org.springframework.data.mongodb.core.convert.MongoTypeMapper#writeType(java.lang.Class, com.mongodb.DBObject) + * @see org.springframework.data.convert.TypeMapper#writeType(java.lang.Class, java.lang.Object) */ public void writeType(Class type, S dbObject) { writeType(ClassTypeInformation.from(type), dbObject); @@ -167,7 +167,7 @@ public class DefaultTypeMapper implements TypeMapper { /* * (non-Javadoc) - * @see org.springframework.data.mongodb.core.convert.MongoTypeMapper#writeType(java.lang.Class, com.mongodb.DBObject) + * @see org.springframework.data.convert.TypeMapper#writeType(org.springframework.data.util.TypeInformation, java.lang.Object) */ public void writeType(TypeInformation info, S sink) { diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/convert/EntityInstantiator.java b/spring-data-commons-core/src/main/java/org/springframework/data/convert/EntityInstantiator.java index 075f3b0d9..a8a93c256 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/convert/EntityInstantiator.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/convert/EntityInstantiator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2013 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. @@ -20,7 +20,7 @@ import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.model.ParameterValueProvider; /** - * SPI to abstract strategies to create instances for {@link PersistentEntities}. + * SPI to abstract strategies to create instances for {@link PersistentEntity}s. * * @author Oliver Gierke */ diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/convert/ReflectionEntityInstantiator.java b/spring-data-commons-core/src/main/java/org/springframework/data/convert/ReflectionEntityInstantiator.java index 21c44227b..6f8cf192e 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/convert/ReflectionEntityInstantiator.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/convert/ReflectionEntityInstantiator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2013 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. @@ -29,7 +29,7 @@ import org.springframework.data.mapping.model.MappingInstantiationException; import org.springframework.data.mapping.model.ParameterValueProvider; /** - * {@link EntityInstantiator} that uses the {@link PersistentEntity}'s {@link MappedConstructor} to instantiate an + * {@link EntityInstantiator} that uses the {@link PersistentEntity}'s {@link PreferredConstructor} to instantiate an * instance of the entity via reflection. * * @author Oliver Gierke @@ -72,7 +72,7 @@ public enum ReflectionEntityInstantiator implements EntityInstantiator { } try { - return (T) BeanUtils.instantiateClass(constructor.getConstructor(), params.toArray()); + return BeanUtils.instantiateClass(constructor.getConstructor(), params.toArray()); } catch (BeanInstantiationException e) { throw new MappingInstantiationException(e.getMessage(), e); } diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/domain/Sort.java b/spring-data-commons-core/src/main/java/org/springframework/data/domain/Sort.java index 9102cb0dc..b734f5aaa 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/domain/Sort.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/domain/Sort.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2013 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. @@ -26,7 +26,7 @@ import org.springframework.util.StringUtils; /** * Sort option for queries. You have to provide at least a list of properties to sort for that must not include - * {@literal null} or empty strings. The direction defaults to {@value Sort#DEFAULT_DIRECTION}. + * {@literal null} or empty strings. The direction defaults to {@link Sort#DEFAULT_DIRECTION}. * * @author Oliver Gierke */ @@ -72,7 +72,7 @@ public class Sort implements Iterable + * @author Jon Brisbin */ public class PreferredConstructor> { @@ -105,7 +105,7 @@ public class PreferredConstructor> { /** * Returns whether the given {@link PersistentProperty} is referenced in a constructor argument of the - * {@link PersistentEntity} backing this {@link MappedConstructor}. + * {@link PersistentEntity} backing this {@link PreferredConstructor}. * * @param property must not be {@literal null}. * @return diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/RepositoryInformation.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/RepositoryInformation.java index a619dad7c..0817102e1 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/RepositoryInformation.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/RepositoryInformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 the original author or authors. + * Copyright 2011-2013 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. @@ -58,7 +58,6 @@ public interface RepositoryInformation extends RepositoryMetadata { /** * Returns all methods considered to be query methods. * - * @param repositoryInterface * @return */ Iterable getQueryMethods(); diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java index 132f09cce..305142b3c 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2012 the original author or authors. + * Copyright 2008-2013 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. @@ -34,9 +34,9 @@ import org.springframework.data.repository.core.NamedQueries; import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.query.QueryLookupStrategy; +import org.springframework.data.repository.query.QueryLookupStrategy.Key; import org.springframework.data.repository.query.QueryMethod; import org.springframework.data.repository.query.RepositoryQuery; -import org.springframework.data.repository.query.QueryLookupStrategy.Key; import org.springframework.data.repository.util.ClassUtils; import org.springframework.util.Assert; @@ -63,10 +63,9 @@ public abstract class RepositoryFactorySupport { /** * Sets the strategy of how to lookup a query to execute finders. * - * @param queryLookupStrategy the createFinderQueries to set + * @param key */ public void setQueryLookupStrategyKey(Key key) { - this.queryLookupStrategyKey = key; } @@ -164,7 +163,7 @@ public abstract class RepositoryFactorySupport { /** * Returns the {@link RepositoryInformation} for the given repository interface. * - * @param repositoryInterface + * @param metadata * @param customImplementationClass * @return */ diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/JacksonResourceReader.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/JacksonResourceReader.java index 98adfdb3d..487738644 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/JacksonResourceReader.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/JacksonResourceReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2013 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. @@ -62,7 +62,7 @@ public class JacksonResourceReader implements ResourceReader { /** * Configures the JSON document's key to lookup the type to instantiate the object. Defaults to - * {@value JacksonResourceReader#DEFAULT_TYPE_KEY}. + * {@link JacksonResourceReader#DEFAULT_TYPE_KEY}. * * @param typeKey */ diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/ResourceReaderRepositoryPopulator.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/ResourceReaderRepositoryPopulator.java index 8a78a432c..1489447eb 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/ResourceReaderRepositoryPopulator.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/init/ResourceReaderRepositoryPopulator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * Copyright 2012-2013 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. @@ -64,11 +64,11 @@ public class ResourceReaderRepositoryPopulator implements RepositoryPopulator, A * @param reader must not be {@literal null}. * @param classLoader */ - public ResourceReaderRepositoryPopulator(ResourceReader resourceReader, ClassLoader classLoader) { + public ResourceReaderRepositoryPopulator(ResourceReader reader, ClassLoader classLoader) { - Assert.notNull(resourceReader); + Assert.notNull(reader); - this.reader = resourceReader; + this.reader = reader; this.classLoader = classLoader; this.resolver = classLoader == null ? new PathMatchingResourcePatternResolver() : new PathMatchingResourcePatternResolver(classLoader); diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/Parameter.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/Parameter.java index a2cd64fff..7e7ab9006 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/Parameter.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/Parameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2013 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. @@ -17,7 +17,6 @@ package org.springframework.data.repository.query; import static java.lang.String.*; -import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.List; @@ -45,13 +44,9 @@ public class Parameter { private final MethodParameter parameter; /** - * Creates a new {@link Parameter} for the given type, {@link Annotation}s, positioned at the given index inside the - * given {@link Parameters}. + * Creates a new {@link Parameter} for the given {@link MethodParameter}. * - * @param type - * @param parameters - * @param index - * @param name + * @param parameter must not be {@literal null}. */ protected Parameter(MethodParameter parameter) { @@ -70,19 +65,16 @@ public class Parameter { * @return */ boolean isFirst() { - return getIndex() == 0; } /** * Returns whether the parameter is a special parameter. * - * @param index * @return * @see #TYPES */ public boolean isSpecialParameter() { - return TYPES.contains(parameter.getParameterType()); } @@ -92,14 +84,12 @@ public class Parameter { * @return */ public boolean isBindable() { - return !isSpecialParameter(); } /** * Returns the placeholder to be used for the parameter. Can either be a named one or positional. * - * @param index * @return */ public String getPlaceholder() { @@ -117,18 +107,15 @@ public class Parameter { * @return */ public int getIndex() { - return parameter.getParameterIndex(); } /** * Returns whether the parameter is annotated with {@link Param}. * - * @param index * @return */ public boolean isNamedParameter() { - return !isSpecialParameter() && getName() != null; } @@ -138,6 +125,7 @@ public class Parameter { * @return */ public String getName() { + Param annotation = parameter.getParameterAnnotation(Param.class); return annotation == null ? parameter.getParameterName() : annotation.value(); } @@ -157,7 +145,6 @@ public class Parameter { */ @Override public String toString() { - return format("%s:%s", isNamedParameter() ? getName() : "#" + getIndex(), getType().getName()); } @@ -167,7 +154,6 @@ public class Parameter { * @return */ boolean isPageable() { - return Pageable.class.isAssignableFrom(getType()); } @@ -177,7 +163,6 @@ public class Parameter { * @return */ boolean isSort() { - return Sort.class.isAssignableFrom(getType()); } } diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/AbstractQueryCreator.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/AbstractQueryCreator.java index 1c0baba08..ef2d4fdbf 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/AbstractQueryCreator.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/AbstractQueryCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2011 the original author or authors. + * Copyright 2008-2013 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. @@ -77,7 +77,7 @@ public abstract class AbstractQueryCreator { * Creates the actual query object applying the given {@link Sort} parameter. Use this method in case you haven't * provided a {@link ParameterAccessor} in the first place but want to apply dynamic sorting nevertheless. * - * @param sort + * @param dynamicSort * @return */ public T createQuery(Sort dynamicSort) { diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java index 8a9727353..7e86b8d4b 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2013 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. @@ -29,7 +29,7 @@ import org.springframework.util.StringUtils; /** * A single part of a method name that has to be transformed into a query part. The actual transformation is defined by * a {@link Type} that is determined from inspecting the given part. The query part can then be looked up via - * {@link #getQueryPart()}. + * {@link #getProperty()}. * * @author Oliver Gierke */ @@ -47,8 +47,7 @@ public class Part { * start parameter index. * * @param part must not be {@literal null}. - * @param clazz must not be {@l - + * @param clazz must not be {@literal null}. */ public Part(String part, Class clazz) { @@ -251,11 +250,10 @@ public class Part { } /** - * Returns whether the the type supports the given raw propertyPath. Default implementation checks whether the - * propertyPath ends with the registered keyword. Does not support the keyword if the propertyPath is a valid field - * as is. + * Returns whether the the type supports the given raw property. Default implementation checks whether the property + * ends with the registered keyword. Does not support the keyword if the property is a valid field as is. * - * @param propertyPath + * @param property * @return */ protected boolean supports(String property) { @@ -324,4 +322,4 @@ public class Part { */ WHEN_POSSIBLE } -} \ No newline at end of file +} diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/util/ClassUtils.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/util/ClassUtils.java index 02d66f1a1..ca5952eb5 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/util/ClassUtils.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/util/ClassUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2011 the original author or authors. + * Copyright 2008-2013 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. @@ -41,7 +41,8 @@ public abstract class ClassUtils { /** * Returns whether the given class contains a property with the given name. * - * @param fieldName + * @param type + * @param property * @return */ public static boolean hasProperty(Class type, String property) { diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/util/ParentTypeAwareTypeInformation.java b/spring-data-commons-core/src/main/java/org/springframework/data/util/ParentTypeAwareTypeInformation.java index 4a4dd2835..1043387df 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/util/ParentTypeAwareTypeInformation.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/util/ParentTypeAwareTypeInformation.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011-2013 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.data.util; import java.lang.reflect.Type; @@ -19,7 +34,8 @@ public abstract class ParentTypeAwareTypeInformation extends TypeDiscoverer parent, Map map) { @@ -32,6 +48,7 @@ public abstract class ParentTypeAwareTypeInformation extends TypeDiscoverer getTypeVariableMap() { return parent == null ? super.getTypeVariableMap() : parent.getTypeVariableMap(); diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableArgumentResolver.java b/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableArgumentResolver.java index 51ad3701d..d593d5a58 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableArgumentResolver.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2011 the original author or authors. + * Copyright 2008-2013 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. @@ -56,7 +56,7 @@ public class PageableArgumentResolver implements WebArgumentResolver { /** * Setter to configure a fallback instance of {@link Pageable} that is being used to back missing parameters. Defaults - * to {@value #DEFAULT_PAGE_REQUEST}. + * to {@link #DEFAULT_PAGE_REQUEST}. * * @param fallbackPagable the fallbackPagable to set */ diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableDefaults.java b/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableDefaults.java index 57fd5f492..ded798036 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableDefaults.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/web/PageableDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2012 the original author or authors. + * Copyright 2008-2013 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. @@ -20,11 +20,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort.Direction; /** - * Annotation to set defaults when injecting a {@link Pageable} into a controller method. + * Annotation to set defaults when injecting a {@link org.springframework.data.domain.Pageable} into a controller + * method. * * @author Oliver Gierke */ @@ -39,7 +39,7 @@ public @interface PageableDefaults { int value() default 10; /** - * The default-pagenumber the injected {@link org.synyx.hades.domain.Pageable} should get if no corresponding + * The default-pagenumber the injected {@link org.springframework.data.domain.Pageable} should get if no corresponding * parameter defined in request (default is 0). */ int pageNumber() default 0; @@ -52,7 +52,7 @@ public @interface PageableDefaults { String[] sort() default {}; /** - * The direction to sort by. Defaults to {@link Direction#ASC. + * The direction to sort by. Defaults to {@link Direction#ASC}. * * @return */