You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by ro...@apache.org on 2010/05/12 15:10:08 UTC
svn commit: r943475 - in /incubator/bval/trunk: ./ bval-core/
bval-core/src/main/java/org/apache/bval/model/ bval-jsr303/
bval-jsr303/src/main/java/org/apache/bval/jsr303/
Author: romanstumm
Date: Wed May 12 13:10:07 2010
New Revision: 943475
URL: http://svn.apache.org/viewvc?rev=943475&view=rev
Log:
BVAL-39 Implicit groups -setting parentMetaBean in core part of framework
merged and removed redundant readme.txt files, only one README.txt
Removed:
incubator/bval/trunk/bval-core/readme.txt
incubator/bval/trunk/bval-jsr303/readme.txt
Modified:
incubator/bval/trunk/README.txt
incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
Modified: incubator/bval/trunk/README.txt
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/README.txt?rev=943475&r1=943474&r2=943475&view=diff
==============================================================================
--- incubator/bval/trunk/README.txt (original)
+++ incubator/bval/trunk/README.txt Wed May 12 13:10:07 2010
@@ -2,6 +2,17 @@ Apache Bean Validation (incubating)
(C) Copyright 2010 The Apache Software Foundation.
--------------------------------------------------------------------------------
+JSR 303 Bean Validation 1.0 Implementation
+==========================================
+This is an implementation of JSR 303 (Bean Validation), a specification of the
+Java API for Javabean validation in Java EE and Java SE.
+The technical objective is to provide a class level constraint declaration and
+validation facility for the Java application developer, as well as a constraint
+metadata repository and query API.
+
+This implementation is based on the validation framework of agimatec GmbH,
+which was contributed to the ASF under a software grant.
+
How to compile the project
==========================
Requirements:
@@ -51,4 +62,18 @@ https://cwiki.apache.org/BeanValidation/
You can checkout latest sources and releases from there.
You can also refer to the test cases in src/test/java/** for examples.
+Project status
+==============
+* The BeanValidation project is currently hosted in the Apache Incubator.
+ Please visit the following for our latest graduation status:
+ http://incubator.apache.org/projects/beanvalidation.html
+
+
+Feedback, questions, contribution
+=================================
+** Your feedback is welcome! **
+
+Checkout our website for more details on how to acess our mailing lists
+or open issues in JIRA:
+ http://incubator.apache.org/beanvalidation/
Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java?rev=943475&r1=943474&r2=943475&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaBean.java Wed May 12 13:10:07 2010
@@ -83,8 +83,14 @@ public class MetaBean extends FeaturesCa
return properties.length > 0;
}
+ /**
+ * bidirectional - set the relationship between a MetaProperty and its parentMetaBean
+ * @param name
+ * @param property
+ */
public void putProperty(String name, MetaProperty property) {
final MetaProperty oldProperty = getProperty(name);
+ if(property != null) property.setParentMetaBean(this);
if (oldProperty == null) { // add
if (properties.length == 0) {
properties = new MetaProperty[1];
Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java?rev=943475&r1=943474&r2=943475&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java Wed May 12 13:10:07 2010
@@ -39,7 +39,7 @@ public class MetaProperty extends Featur
public MetaProperty() {
}
- /** the meta info of the target bean (mainly for relationships) */
+ /** the metabean of the target bean (mainly for relationships) */
public MetaBean getMetaBean() {
return metaBean;
}
@@ -47,7 +47,10 @@ public class MetaProperty extends Featur
public void setMetaBean(MetaBean metaBean) {
this.metaBean = metaBean;
}
-
+
+ /**
+ * the metabean that owns this property (set by MetaBean.putProperty())
+ */
public MetaBean getParentMetaBean() {
return parentMetaBean;
}
Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java?rev=943475&r1=943474&r2=943475&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java (original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java Wed May 12 13:10:07 2010
@@ -190,13 +190,11 @@ public class Jsr303MetaBeanFactory imple
if (!factoryContext.getFactory().getAnnotationIgnores()
.isIgnoreAnnotations(field)) {
if (metaProperty == null) {
- metaProperty = createMetaProperty(metabean, field.getName(), field.getType());
- /*if (*/
+ metaProperty = createMetaProperty(field.getName(), field.getType());
+ metabean.putProperty(metaProperty.getName(), metaProperty);
processAnnotations(metaProperty, beanClass, field,
new FieldAccess(field),
new AppendValidationToMeta(metaProperty));//) {
- metabean.putProperty(metaProperty.getName(), metaProperty);
- //}
} else {
processAnnotations(metaProperty, beanClass, field,
new FieldAccess(field),
@@ -218,13 +216,11 @@ public class Jsr303MetaBeanFactory imple
// create a property for those methods for which there is not yet a MetaProperty
if (metaProperty == null) {
metaProperty =
- createMetaProperty(metabean, propName, method.getReturnType());
- /*if (*/
+ createMetaProperty(propName, method.getReturnType());
+ metabean.putProperty(propName, metaProperty);
processAnnotations(metaProperty, beanClass, method,
new MethodAccess(propName, method),
new AppendValidationToMeta(metaProperty));//) {
- metabean.putProperty(propName, metaProperty);
- //}
} else {
processAnnotations(metaProperty, beanClass, method,
new MethodAccess(propName, method),
@@ -249,7 +245,7 @@ public class Jsr303MetaBeanFactory imple
metaProperty =
metabean.getProperty(meta.getAccessStrategy().getPropertyName());
if (metaProperty == null) {
- metaProperty = createMetaProperty(metabean,
+ metaProperty = createMetaProperty(
meta.getAccessStrategy().getPropertyName(),
meta.getAccessStrategy().getJavaType());
metabean.putProperty(metaProperty.getName(), metaProperty);
@@ -265,19 +261,18 @@ public class Jsr303MetaBeanFactory imple
MetaProperty metaProperty = metabean.getProperty(access.getPropertyName());
if (metaProperty == null) {
metaProperty =
- createMetaProperty(metabean, access.getPropertyName(), access.getJavaType());
+ createMetaProperty(access.getPropertyName(), access.getJavaType());
metabean.putProperty(metaProperty.getName(), metaProperty);
}
processValid(metaProperty, access);
}
}
- private MetaProperty createMetaProperty(MetaBean parentMetaBean, String propName, Type type) {
+ private MetaProperty createMetaProperty(String propName, Type type) {
MetaProperty metaProperty;
metaProperty = new MetaProperty();
metaProperty.setName(propName);
metaProperty.setType(type);
- metaProperty.setParentMetaBean(parentMetaBean);
return metaProperty;
}