handler); + void doWithProperties(SimplePropertyHandler handler); + /** * Applies the given {@link AssociationHandler} to all {@link Association} contained in this {@link PersistentEntity}. * * @param handler must not be {@literal null}. */ void doWithAssociations(AssociationHandler
handler);
+
+ void doWithAssociations(SimpleAssociationHandler handler);
}
diff --git a/src/main/java/org/springframework/data/mapping/SimpleAssociationHandler.java b/src/main/java/org/springframework/data/mapping/SimpleAssociationHandler.java
new file mode 100644
index 000000000..1827600b3
--- /dev/null
+++ b/src/main/java/org/springframework/data/mapping/SimpleAssociationHandler.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.mapping;
+
+/**
+ * Association handler to work with the untyped {@link PersistentProperty} based {@link Association}.
+ *
+ * @author Oliver Gierke
+ * @see PropertyHandler
+ */
+public interface SimpleAssociationHandler {
+
+ /**
+ * Handle the given {@link Association}.
+ *
+ * @param association will never be {@literal null}.
+ */
+ void doWithAssociation(Association extends PersistentProperty>> association);
+}
diff --git a/src/main/java/org/springframework/data/mapping/SimplePropertyHandler.java b/src/main/java/org/springframework/data/mapping/SimplePropertyHandler.java
new file mode 100644
index 000000000..fb4c5e3dd
--- /dev/null
+++ b/src/main/java/org/springframework/data/mapping/SimplePropertyHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 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.mapping;
+
+/**
+ * A property handler to work with untyped {@link PersistentProperty} instances.
+ *
+ * @author Oliver Gierke
+ */
+public interface SimplePropertyHandler {
+
+ /**
+ * Handle the given {@link PersistentProperty}.
+ *
+ * @param property will never be {@literal null}.
+ */
+ void doWithPersistentProperty(PersistentProperty> property);
+}
diff --git a/src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java b/src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java
index 3488be45e..d95b607cc 100644
--- a/src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java
+++ b/src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java
@@ -30,6 +30,8 @@ import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PreferredConstructor;
import org.springframework.data.mapping.PropertyHandler;
+import org.springframework.data.mapping.SimpleAssociationHandler;
+import org.springframework.data.mapping.SimplePropertyHandler;
import org.springframework.data.util.TypeInformation;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -251,7 +253,9 @@ public class BasicPersistentEntity handler) {
+
Assert.notNull(handler);
+
for (P property : properties) {
if (!property.isTransient() && !property.isAssociation()) {
handler.doWithPersistentProperty(property);
@@ -259,17 +263,48 @@ public class BasicPersistentEntity handler) {
+
Assert.notNull(handler);
+
for (Association association : associations) {
handler.doWithAssociation(association);
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.springframework.data.mapping.PersistentEntity#doWithAssociations(org.springframework.data.mapping.SimpleAssociationHandler)
+ */
+ public void doWithAssociations(SimpleAssociationHandler handler) {
+
+ Assert.notNull(handler);
+
+ for (Association extends PersistentProperty>> association : associations) {
+ handler.doWithAssociation(association);
+ }
+ }
+
/* (non-Javadoc)
* @see org.springframework.data.mapping.MutablePersistentEntity#verify()
*/
diff --git a/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java b/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java
index 1c35c5d48..c65b52b0b 100644
--- a/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java
+++ b/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java
@@ -124,12 +124,14 @@ public abstract class CdiRepositoryExtensionSupport implements Extension {
return repositoryTypes.entrySet();
}
+ @SuppressWarnings("all")
static class DefaultAnnotationLiteral extends AnnotationLiteral extends TypeDiscoverer {
*
* @param type
*/
+ @SuppressWarnings("deprecation")
ClassTypeInformation(Class type) {
this(type, GenericTypeResolver.getTypeVariableMap(type));
}
diff --git a/src/main/java/org/springframework/data/util/ParameterizedTypeInformation.java b/src/main/java/org/springframework/data/util/ParameterizedTypeInformation.java
index 1d11fa730..c466c275f 100644
--- a/src/main/java/org/springframework/data/util/ParameterizedTypeInformation.java
+++ b/src/main/java/org/springframework/data/util/ParameterizedTypeInformation.java
@@ -53,6 +53,7 @@ class ParameterizedTypeInformation implements TypeInformation {
private final Type type;
- @SuppressWarnings("rawtypes")
- private final Map resolvedType;
@@ -95,6 +94,7 @@ class TypeDiscoverer implements TypeInformation {
return new ClassTypeInformation((Class>) fieldType);
}
+ @SuppressWarnings("deprecation")
Map implements TypeInformation {
* @param type
* @return
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "deprecation" })
protected Class resolveType(Type type) {
-
return (Class) GenericTypeResolver.resolveType(type, getTypeVariableMap());
}