You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/02/22 18:24:09 UTC
svn commit: r1073423 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
Author: lu4242
Date: Tue Feb 22 17:24:08 2011
New Revision: 1073423
URL: http://svn.apache.org/viewvc?rev=1073423&view=rev
Log:
MYFACES-3054 Allow forClass and value (converterId) together for @FacesConverter (thanks to Martin Koci for provide this patch)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java?rev=1073423&r1=1073422&r2=1073423&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java Tue Feb 22 17:24:08 2011
@@ -26,6 +26,7 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.faces.FacesException;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.CustomScoped;
import javax.faces.bean.ManagedBean;
@@ -145,19 +146,25 @@ public class AnnotationConfigurator
}
//If there is a previous entry on Application Configuration Resources,
//the entry there takes precedence
- if (!Object.class.equals(conv.forClass()))
+ boolean hasForClass = !Object.class.equals(conv.forClass());
+ boolean hasValue = conv.value().length() > 0;
+ if (hasForClass || hasValue)
{
Converter converter = new Converter();
- converter.setForClass(conv.forClass().getName());
+ if (hasForClass)
+ {
+ converter.setForClass(conv.forClass().getName());
+ }
+ if (hasValue) {
+ converter.setConverterId(conv.value());
+ }
converter.setConverterClass(clazz.getName());
facesConfig.addConverter(converter);
}
else
- {
- Converter converter = new Converter();
- converter.setConverterId(conv.value());
- converter.setConverterClass(clazz.getName());
- facesConfig.addConverter(converter);
+ {
+ // TODO MartinKoci MYFACES-3053
+ throw new FacesException("@FacesConverter must have value, forClass or both. Check annotation @FacesConverter on class: " + clazz.getName());
}
}
}