Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
new file mode 100644
index 0000000000..b4444380b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class PersistentPropertyValidator
+ extends AbstractPersistentAttributeValidator
+{
+
+ protected PropertyAccessor propertyAccessor;
+
+ public PersistentPropertyValidator(
+ ReadOnlyPersistentAttribute persistentAttribute, PropertyAccessor propertyAccessor, PersistentAttributeTextRangeResolver textRangeResolver)
+ {
+ super(persistentAttribute, textRangeResolver);
+ this.propertyAccessor = propertyAccessor;
+ }
+
+ @Override
+ //TODO validation for null getter or null setter - would apply to EclipseLink too
+ //TODO validation for annotated setter? - would apply to EclipseLink too
+ protected void validateMappedAttribute(List<IMessage> messages) {
+ if (this.propertyAccessor.getResourceGetter() != null && this.propertyAccessor.getResourceGetter().isFinal()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER));
+ }
+ if (this.propertyAccessor.getResourceSetter() != null && this.propertyAccessor.getResourceSetter().isFinal()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_SETTER));
+ }
+ }
+}

Back to the top