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 2008/07/31 19:29:02 UTC
svn commit: r681422 [1/4] - in
/myfaces/extensions/validator/branches/trunk_layout_myfaces/core: ./
src/main/java/org/apache/myfaces/extensions/validator/core/
src/main/java/org/apache/myfaces/extensions/validator/core/adapter/
src/main/java/org/apache...
Author: lu4242
Date: Thu Jul 31 10:28:59 2008
New Revision: 681422
URL: http://svn.apache.org/viewvc?rev=681422&view=rev
Log:
Apply checkstyle rules
Modified:
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/ (props changed)
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/AbstractStartupConfigListener.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ClassMappingFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplication.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplicationFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValConverter.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProcessedInformationEntry.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProxyMappingPhaseListener.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/DefaultConverterAdapterFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/ExtValFallbackConverter.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/mapper/CustomConfiguredConverterToAdapterNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/mapper/CustomConventionConverterToAdapterNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/mapper/DefaultConverterToAdapterNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/mapper/SimpleConverterToAdapterNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/AnnotationEntry.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractor.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractorFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultAnnotationExtractorFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractor.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConfiguredValidationStrategyToMsgResolverNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/ELUtils.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/FaceletsTaglibExpressionUtils.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java
Propchange: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jul 31 10:28:59 2008
@@ -7,4 +7,4 @@
*.iws
.settings
maven-eclipse.xml
-.externalToolsBuilder
+.externalToolBuilders
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/AbstractStartupConfigListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/AbstractStartupConfigListener.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/AbstractStartupConfigListener.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/AbstractStartupConfigListener.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -31,32 +31,50 @@
/**
* @author Gerhard Petracek
*/
-public abstract class AbstractStartupConfigListener implements PhaseListener {
+public abstract class AbstractStartupConfigListener implements PhaseListener
+{
protected final Log logger = LogFactory.getLog(getClass());
//don't remove - it's a fallback if there is a problem with deregistration
//target: don't process init logic more than once
private static List<Class> initializedListeners = new ArrayList<Class>();
- public void afterPhase(PhaseEvent event) {
+ public void afterPhase(PhaseEvent event)
+ {
}
- public void beforePhase(PhaseEvent event) {
- synchronized (AbstractStartupConfigListener.class) {
- if (!initializedListeners.contains(getClass())) {
- try {
+ public void beforePhase(PhaseEvent event)
+ {
+ synchronized (AbstractStartupConfigListener.class)
+ {
+ if (!initializedListeners.contains(getClass()))
+ {
+ try
+ {
init();
ExtValUtils.deregisterPhaseListener(this);
- } catch (Throwable t) {
- this.logger.warn("an exception occurred while deregistering the phase-listener" + getClass().getName() + " -> there is just a little overhead, but everything else works correctly. however, please inform the community about your configuration", t);
- } finally {
+ }
+ catch (Throwable t)
+ {
+ this.logger
+ .warn(
+ "an exception occurred while deregistering the phase-listener"
+ + getClass().getName()
+ + " -> there is just a little overhead,"
+ + " but everything else works correctly."
+ + " however, please inform the community about your configuration",
+ t);
+ }
+ finally
+ {
initializedListeners.add(getClass());
}
}
}
}
- public PhaseId getPhaseId() {
+ public PhaseId getPhaseId()
+ {
return PhaseId.RESTORE_VIEW;
}
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ClassMappingFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ClassMappingFactory.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ClassMappingFactory.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ClassMappingFactory.java Thu Jul 31 10:28:59 2008
@@ -1,26 +1,27 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
/**
* @author Gerhard Petracek
*/
-public interface ClassMappingFactory<P, R> {
+public interface ClassMappingFactory<P, R>
+{
R create(P source);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplication.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplication.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplication.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplication.java Thu Jul 31 10:28:59 2008
@@ -1,29 +1,33 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.extensions.validator.util.ExtValUtils;
-import org.apache.myfaces.extensions.validator.util.FactoryUtils;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
-import javax.el.*;
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.NavigationHandler;
@@ -33,241 +37,310 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.el.*;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
import javax.faces.event.ActionListener;
import javax.faces.validator.Validator;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.FactoryUtils;
/**
* @author Gerhard Petracek
*/
@SuppressWarnings("deprecation,unchecked")
-public class ExtValApplication extends Application {
+public class ExtValApplication extends Application
+{
protected final Log logger = LogFactory.getLog(getClass());
private Application wrapped;
- public ExtValApplication() {
+ public ExtValApplication()
+ {
}
- public ExtValApplication(Application wrapped) {
+ public ExtValApplication(Application wrapped)
+ {
this.wrapped = wrapped;
}
public UIComponent createComponent(ValueBinding componentBinding,
- FacesContext context, String componentType) throws FacesException {
- UIComponent component = this.wrapped.createComponent(componentBinding, context, componentType);
+ FacesContext context, String componentType) throws FacesException
+ {
+ UIComponent component = this.wrapped.createComponent(componentBinding,
+ context, componentType);
return tryToSetExtValValidatingConverter(component);
}
- private UIComponent tryToSetExtValValidatingConverter(UIComponent component) {
+ private UIComponent tryToSetExtValValidatingConverter(UIComponent component)
+ {
//in order to access the wrapped application and and support other Application wrappers
ExtValUtils.setOriginalApplication(wrapped);
- //if no converter is used add sev-en converter - so it isn't necessary to add sev-en converter manually within the page
- if (component instanceof EditableValueHolder) {
- ((EditableValueHolder) component).setConverter(new ExtValConverter());
+ //if no converter is used add sev-en converter - so it isn't
+ //necessary to add sev-en converter manually within the page
+ if (component instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder) component)
+ .setConverter(new ExtValConverter());
}
return component;
}
- public Converter createConverter(String converterId) throws FacesException {
+ public Converter createConverter(String converterId) throws FacesException
+ {
Converter converter = this.wrapped.createConverter(converterId);
return getExtValConverter(converter);
}
- public Converter createConverter(Class targetClass) throws FacesException {
+ public Converter createConverter(Class targetClass) throws FacesException
+ {
Converter converter = this.wrapped.createConverter(targetClass);
return getExtValConverter(converter);
}
- private Converter getExtValConverter(Converter converter) {
- if (converter == null) {
+ private Converter getExtValConverter(Converter converter)
+ {
+ if (converter == null)
+ {
return new ExtValConverter();
}
- if (!ExtValUtils.useFallbackAdapters()) {
+ if (!ExtValUtils.useFallbackAdapters())
+ {
return ExtValConverter.newInstance(converter);
- } else {
+ }
+ else
+ {
//fallback adapter solution
- //if there is a problem with the default approach (the phase-listener) or the alternative (the state-manager)
+ //if there is a problem with the default approach (the phase-listener)
+ //or the alternative (the state-manager)
return FactoryUtils.getConverterAdapterFactory().create(converter);
}
}
- public Iterator getConverterIds() {
+ public Iterator getConverterIds()
+ {
return this.wrapped.getConverterIds();
}
- public Iterator getConverterTypes() {
+ public Iterator getConverterTypes()
+ {
return this.wrapped.getConverterTypes();
}
- public void addConverter(String converterId, String converterClass) {
+ public void addConverter(String converterId, String converterClass)
+ {
this.wrapped.addConverter(converterId, converterClass);
}
- public void addConverter(Class targetClass, String converterClass) {
+ public void addConverter(Class targetClass, String converterClass)
+ {
this.wrapped.addConverter(targetClass, converterClass);
}
- public Iterator getComponentTypes() {
+ public Iterator getComponentTypes()
+ {
return this.wrapped.getComponentTypes();
}
- public ActionListener getActionListener() {
+ public ActionListener getActionListener()
+ {
return this.wrapped.getActionListener();
}
- public void setActionListener(ActionListener listener) {
+ public void setActionListener(ActionListener listener)
+ {
this.wrapped.setActionListener(listener);
}
- public Locale getDefaultLocale() {
+ public Locale getDefaultLocale()
+ {
return this.wrapped.getDefaultLocale();
}
- public void setDefaultLocale(Locale locale) {
+ public void setDefaultLocale(Locale locale)
+ {
this.wrapped.setDefaultLocale(locale);
}
- public String getDefaultRenderKitId() {
+ public String getDefaultRenderKitId()
+ {
return this.wrapped.getDefaultRenderKitId();
}
- public void setDefaultRenderKitId(String renderKitId) {
+ public void setDefaultRenderKitId(String renderKitId)
+ {
this.wrapped.setDefaultRenderKitId(renderKitId);
}
- public String getMessageBundle() {
+ public String getMessageBundle()
+ {
return this.wrapped.getMessageBundle();
}
- public void setMessageBundle(String bundle) {
+ public void setMessageBundle(String bundle)
+ {
this.wrapped.setMessageBundle(bundle);
}
- public NavigationHandler getNavigationHandler() {
+ public NavigationHandler getNavigationHandler()
+ {
return this.wrapped.getNavigationHandler();
}
- public void setNavigationHandler(NavigationHandler handler) {
+ public void setNavigationHandler(NavigationHandler handler)
+ {
this.wrapped.setNavigationHandler(handler);
}
- public PropertyResolver getPropertyResolver() {
+ public PropertyResolver getPropertyResolver()
+ {
return this.wrapped.getPropertyResolver();
}
- public void setPropertyResolver(PropertyResolver resolver) {
+ public void setPropertyResolver(PropertyResolver resolver)
+ {
this.wrapped.setPropertyResolver(resolver);
}
- public VariableResolver getVariableResolver() {
+ public VariableResolver getVariableResolver()
+ {
return this.wrapped.getVariableResolver();
}
- public void setVariableResolver(VariableResolver resolver) {
+ public void setVariableResolver(VariableResolver resolver)
+ {
this.wrapped.setVariableResolver(resolver);
}
- public ViewHandler getViewHandler() {
+ public ViewHandler getViewHandler()
+ {
return this.wrapped.getViewHandler();
}
- public void setViewHandler(ViewHandler handler) {
+ public void setViewHandler(ViewHandler handler)
+ {
this.wrapped.setViewHandler(handler);
}
- public StateManager getStateManager() {
+ public StateManager getStateManager()
+ {
return this.wrapped.getStateManager();
}
- public void setStateManager(StateManager manager) {
+ public void setStateManager(StateManager manager)
+ {
this.wrapped.setStateManager(manager);
}
- public void addComponent(String componentType, String componentClass) {
+ public void addComponent(String componentType, String componentClass)
+ {
this.wrapped.addComponent(componentType, componentClass);
}
- public UIComponent createComponent(String componentType) throws FacesException {
+ public UIComponent createComponent(String componentType)
+ throws FacesException
+ {
UIComponent component = this.wrapped.createComponent(componentType);
return tryToSetExtValValidatingConverter(component);
}
public MethodBinding createMethodBinding(String ref, Class[] params)
- throws ReferenceSyntaxException {
+ throws ReferenceSyntaxException
+ {
return this.wrapped.createMethodBinding(ref, params);
}
- public Iterator getSupportedLocales() {
+ public Iterator getSupportedLocales()
+ {
return this.wrapped.getSupportedLocales();
}
- public void setSupportedLocales(Collection locales) {
+ public void setSupportedLocales(Collection locales)
+ {
this.wrapped.setSupportedLocales(locales);
}
- public void addValidator(String validatorId, String validatorClass) {
+ public void addValidator(String validatorId, String validatorClass)
+ {
this.wrapped.addValidator(validatorId, validatorClass);
}
- public Validator createValidator(String validatorId) throws FacesException {
+ public Validator createValidator(String validatorId) throws FacesException
+ {
return this.wrapped.createValidator(validatorId);
}
- public Iterator getValidatorIds() {
+ public Iterator getValidatorIds()
+ {
return this.wrapped.getValidatorIds();
}
public ValueBinding createValueBinding(String ref)
- throws ReferenceSyntaxException {
+ throws ReferenceSyntaxException
+ {
return this.wrapped.createValueBinding(ref);
}
/*
* jsf 1.2 methods
*/
- public void addELResolver(ELResolver elResolver) {
+ public void addELResolver(ELResolver elResolver)
+ {
this.wrapped.addELResolver(elResolver);
}
- public ELResolver getELResolver() {
+ public ELResolver getELResolver()
+ {
return this.wrapped.getELResolver();
}
- public ResourceBundle getResourceBundle(FacesContext facesContext, String s) throws FacesException, NullPointerException {
+ public ResourceBundle getResourceBundle(FacesContext facesContext, String s)
+ throws FacesException, NullPointerException
+ {
return this.wrapped.getResourceBundle(facesContext, s);
}
- public UIComponent createComponent(ValueExpression valueExpression, FacesContext facesContext, String s) throws FacesException, NullPointerException {
- UIComponent component = this.wrapped.createComponent(valueExpression, facesContext, s);
+ public UIComponent createComponent(ValueExpression valueExpression,
+ FacesContext facesContext, String s) throws FacesException,
+ NullPointerException
+ {
+ UIComponent component = this.wrapped.createComponent(valueExpression,
+ facesContext, s);
return tryToSetExtValValidatingConverter(component);
}
- public ExpressionFactory getExpressionFactory() {
+ public ExpressionFactory getExpressionFactory()
+ {
return this.wrapped.getExpressionFactory();
}
- public void addELContextListener(ELContextListener elContextListener) {
+ public void addELContextListener(ELContextListener elContextListener)
+ {
this.wrapped.addELContextListener(elContextListener);
}
- public void removeELContextListener(ELContextListener elContextListener) {
+ public void removeELContextListener(ELContextListener elContextListener)
+ {
this.wrapped.removeELContextListener(elContextListener);
}
- public ELContextListener[] getELContextListeners() {
+ public ELContextListener[] getELContextListeners()
+ {
return this.wrapped.getELContextListeners();
}
- public Object evaluateExpressionGet(FacesContext facesContext, String s, Class aClass) throws ELException {
+ public Object evaluateExpressionGet(FacesContext facesContext, String s,
+ Class aClass) throws ELException
+ {
return this.wrapped.evaluateExpressionGet(facesContext, s, aClass);
}
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplicationFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplicationFactory.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplicationFactory.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValApplicationFactory.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -27,27 +27,35 @@
/**
* @author Gerhard Petracek
*/
-public class ExtValApplicationFactory extends ApplicationFactory {
+public class ExtValApplicationFactory extends ApplicationFactory
+{
protected final Log logger = LogFactory.getLog(getClass());
private ApplicationFactory wrapped;
- public ExtValApplicationFactory(ApplicationFactory applicationFactory) {
+ public ExtValApplicationFactory(ApplicationFactory applicationFactory)
+ {
this.wrapped = applicationFactory;
setApplication(applicationFactory.getApplication());
- logger.trace("myfaces-extension-validator application factory instantiated");
+ logger
+ .trace("myfaces-extension-validator application factory instantiated");
}
- public Application getApplication() {
+ public Application getApplication()
+ {
return this.wrapped.getApplication();
}
- public void setApplication(Application application) {
- if (!(application instanceof ExtValApplication)) {
+ public void setApplication(Application application)
+ {
+ if (!(application instanceof ExtValApplication))
+ {
logger.trace("myfaces-extension-validator application created");
this.wrapped.setApplication(new ExtValApplication(application));
- } else {
+ }
+ else
+ {
this.wrapped.setApplication(application);
}
}
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValConverter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValConverter.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValConverter.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValConverter.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -43,13 +43,17 @@
/**
* @author Gerhard Petracek
*/
-public class ExtValConverter implements Converter, MethodInterceptor, Serializable {
+public class ExtValConverter implements Converter, MethodInterceptor,
+ Serializable
+{
protected final Log logger = LogFactory.getLog(getClass());
- public static Converter newInstance(Converter wrappedConverter) {
+ public static Converter newInstance(Converter wrappedConverter)
+ {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(wrappedConverter.getClass());
- enhancer.setInterfaces(new Class[]{Converter.class, Serializable.class});
+ enhancer.setInterfaces(new Class[] { Converter.class,
+ Serializable.class });
enhancer.setCallback(new ExtValConverter());
ExtValUtils.increaseProcessedConverterCount();
@@ -57,107 +61,161 @@
return (Converter) enhancer.create();
}
- public ExtValConverter() {
+ public ExtValConverter()
+ {
logger.trace("myfaces-extension-validator converter instantiated");
}
- public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) {
+ public Object getAsObject(FacesContext facesContext,
+ UIComponent uiComponent, String s)
+ {
- Object convertedObject = getConvertedObject(facesContext, uiComponent, s);
+ Object convertedObject = getConvertedObject(facesContext, uiComponent,
+ s);
processExtValValidation(facesContext, uiComponent, convertedObject);
return convertedObject;
}
- public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object o) {
+ public String getAsString(FacesContext facesContext,
+ UIComponent uiComponent, Object o)
+ {
//indirect approach for complex components
- Converter converter = ExtValUtils.tryToCreateOriginalConverter(facesContext, uiComponent);
- return (converter == null) ? (o == null) ? null : o.toString() : converter.getAsString(facesContext, uiComponent, o);
+ Converter converter = ExtValUtils.tryToCreateOriginalConverter(
+ facesContext, uiComponent);
+ return (converter == null) ? (o == null) ? null : o.toString()
+ : converter.getAsString(facesContext, uiComponent, o);
}
- public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
+ public Object intercept(Object obj, Method method, Object[] args,
+ MethodProxy proxy) throws Throwable
+ {
Object convertedObject = proxy.invokeSuper(obj, args);
- if (method.getName().equals("getAsObject")) {
- processExtValValidation((FacesContext) args[0], (UIComponent) args[1], convertedObject);
- } else if (method.getName().equals("getAsString")) {
- storeComponentConverterMappingForProxies((FacesContext) args[0], (UIComponent) args[1], (Converter)obj);
+ if (method.getName().equals("getAsObject"))
+ {
+ processExtValValidation((FacesContext) args[0],
+ (UIComponent) args[1], convertedObject);
+ }
+ else if (method.getName().equals("getAsString"))
+ {
+ storeComponentConverterMappingForProxies((FacesContext) args[0],
+ (UIComponent) args[1], (Converter) obj);
}
return convertedObject;
}
- protected Object getConvertedObject(FacesContext facesContext, UIComponent uiComponent, String s) {
+ protected Object getConvertedObject(FacesContext facesContext,
+ UIComponent uiComponent, String s)
+ {
//indirect approach for complex components
//TODO
- Converter converter = ExtValUtils.tryToCreateOriginalConverter(facesContext, uiComponent);
- return (converter != null) ? converter.getAsObject(facesContext, uiComponent, s) : s;
+ Converter converter = ExtValUtils.tryToCreateOriginalConverter(
+ facesContext, uiComponent);
+ return (converter != null) ? converter.getAsObject(facesContext,
+ uiComponent, s) : s;
}
/*
* private methods
*/
- private void createValueBindingConvertedValueMapping(UIComponent uiComponent, Object convertedObject) {
+ private void createValueBindingConvertedValueMapping(
+ UIComponent uiComponent, Object convertedObject)
+ {
//to support local cross-validation (within the same entity)
- Map<String, ProcessedInformationEntry> valueBindingConvertedValueMapping = ExtValUtils.getOrInitValueBindingConvertedValueMapping();
+ Map<String, ProcessedInformationEntry> valueBindingConvertedValueMapping = ExtValUtils
+ .getOrInitValueBindingConvertedValueMapping();
String valueBindingExpression;
ProcessedInformationEntry entry;
- valueBindingExpression = ELUtils.getReliableValueBindingExpression(uiComponent);
+ valueBindingExpression = ELUtils
+ .getReliableValueBindingExpression(uiComponent);
- if (valueBindingExpression == null) {
+ if (valueBindingExpression == null)
+ {
return;
}
entry = new ProcessedInformationEntry();
- entry.setBean(ELUtils.getBeanObject(valueBindingExpression, uiComponent));
+ entry.setBean(ELUtils
+ .getBeanObject(valueBindingExpression, uiComponent));
entry.setConvertedValue(convertedObject);
entry.setComponent(uiComponent);
//for local cross-validation
- if (valueBindingConvertedValueMapping.containsKey(valueBindingExpression) && !valueBindingConvertedValueMapping.get(valueBindingExpression).getBean().equals(entry.getBean())) {
+ if (valueBindingConvertedValueMapping
+ .containsKey(valueBindingExpression)
+ && !valueBindingConvertedValueMapping.get(
+ valueBindingExpression).getBean().equals(
+ entry.getBean()))
+ {
//for the validation within a complex component e.g. a table
//don't override existing expression (style: #{entry.property}) - make a special mapping
- List<ProcessedInformationEntry> furtherEntries = valueBindingConvertedValueMapping.get(valueBindingExpression).getFurtherEntries();
- if (furtherEntries == null) {
+ List<ProcessedInformationEntry> furtherEntries = valueBindingConvertedValueMapping
+ .get(valueBindingExpression).getFurtherEntries();
+ if (furtherEntries == null)
+ {
furtherEntries = new ArrayList<ProcessedInformationEntry>();
- valueBindingConvertedValueMapping.get(valueBindingExpression).setFurtherEntries(furtherEntries);
+ valueBindingConvertedValueMapping.get(valueBindingExpression)
+ .setFurtherEntries(furtherEntries);
}
furtherEntries.add(entry);
- } else {
+ }
+ else
+ {
//for normal validation
- valueBindingConvertedValueMapping.put(valueBindingExpression, entry);
+ valueBindingConvertedValueMapping
+ .put(valueBindingExpression, entry);
}
}
- private void processExtValValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject) {
- if (uiComponent instanceof EditableValueHolder) {
+ private void processExtValValidation(FacesContext facesContext,
+ UIComponent uiComponent, Object convertedObject)
+ {
+ if (uiComponent instanceof EditableValueHolder)
+ {
ValidationStrategy validationStrategy;
- AnnotationExtractor annotationExtractor = FactoryUtils.getAnnotationExtractorFactory().create();
- for (AnnotationEntry entry : annotationExtractor.extractAnnotations(facesContext, uiComponent)) {
- validationStrategy = FactoryUtils.getValidationStrategyFactory().create(entry.getAnnotation());
-
- if (validationStrategy != null) {
- validationStrategy.validate(facesContext, uiComponent, entry, convertedObject);
- } else {
- logger.trace("no validation strategy found for " + entry.getAnnotation().annotationType().getName());
+ AnnotationExtractor annotationExtractor = FactoryUtils
+ .getAnnotationExtractorFactory().create();
+ for (AnnotationEntry entry : annotationExtractor
+ .extractAnnotations(facesContext, uiComponent))
+ {
+ validationStrategy = FactoryUtils
+ .getValidationStrategyFactory().create(
+ entry.getAnnotation());
+
+ if (validationStrategy != null)
+ {
+ validationStrategy.validate(facesContext, uiComponent,
+ entry, convertedObject);
+ }
+ else
+ {
+ logger.trace("no validation strategy found for "
+ + entry.getAnnotation().annotationType().getName());
}
}
//build mapping value-binding -> processed information entry
- createValueBindingConvertedValueMapping(uiComponent, convertedObject);
+ createValueBindingConvertedValueMapping(uiComponent,
+ convertedObject);
}
}
-
- private void storeComponentConverterMappingForProxies(FacesContext facesContext, UIComponent uiComponent, Converter converter) {
- if (ExtValUtils.useProxyMapping()) {
- ExtValUtils.getOrInitProxyMapping().put(uiComponent.getClientId(facesContext), converter);
+ private void storeComponentConverterMappingForProxies(
+ FacesContext facesContext, UIComponent uiComponent,
+ Converter converter)
+ {
+ if (ExtValUtils.useProxyMapping())
+ {
+ ExtValUtils.getOrInitProxyMapping().put(
+ uiComponent.getClientId(facesContext), converter);
ExtValUtils.decreaseProcessedConverterCount();
}
}
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -27,68 +27,86 @@
/**
* centralized in order that these information arn't spread over the complete code base
- * + some of them can be customized within a custom impl. of the bean (extend this class and provide it via convention or web.xml)
+ * + some of them can be customized within a custom impl. of the bean
+ * (extend this class and provide it via convention or web.xml)
* <p/>
* the static api should only be used
*
* @author Gerhard Petracek
*/
-public class InformationProviderBean {
- public static final String BEAN_NAME = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME + "." + InformationProviderBean.class.getSimpleName();
+public class InformationProviderBean
+{
+ public static final String BEAN_NAME = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+ + "." + InformationProviderBean.class.getSimpleName();
//custom class which is an optional replacement for this class (has to extend this class)
- public static final String CUSTOM_BEAN = (ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME + ".custom." + InformationProviderBean.class.getSimpleName()).replace(".", "_");
+ public static final String CUSTOM_BEAN = (ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+ + ".custom." + InformationProviderBean.class.getSimpleName())
+ .replace(".", "_");
private String basePackage = WebXmlParameter.CUSTOM_EXTENSION_BASE_PACKAGE;
- public InformationProviderBean() {
- if (this.basePackage == null) {
- this.basePackage = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME + ".custom.";
+ public InformationProviderBean()
+ {
+ if (this.basePackage == null)
+ {
+ this.basePackage = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+ + ".custom.";
}
- if (!this.basePackage.endsWith(".")) {
+ if (!this.basePackage.endsWith("."))
+ {
this.basePackage = this.basePackage + ".";
}
}
- public String getBasePackage() {
+ public String getBasePackage()
+ {
return basePackage;
}
- public String getCustomAnnotationExtractorFactory() {
+ public String getCustomAnnotationExtractorFactory()
+ {
return this.basePackage + "AnnotationExtractorFactory";
}
- public String getCustomAnnotationExtractor() {
+ public String getCustomAnnotationExtractor()
+ {
return this.basePackage + "AnnotationExtractor";
}
/*
* name mapper
*/
- public String getCustomValidationStrategyToMsgResolverNameMapper() {
+ public String getCustomValidationStrategyToMsgResolverNameMapper()
+ {
return this.basePackage + "ValidationStrategyToMsgResolverNameMapper";
}
- public String getCustomAnnotationToValidationStrategyNameMapper() {
+ public String getCustomAnnotationToValidationStrategyNameMapper()
+ {
return this.basePackage + "AnnotationToValidationStrategyNameMapper";
}
@Deprecated
- public String getCustomAdapterNameMapper() {
+ public String getCustomAdapterNameMapper()
+ {
return this.basePackage + "AdapterNameMapper";
}
/*
* factories
*/
- public String getCustomMessageResolverFactory() {
+ public String getCustomMessageResolverFactory()
+ {
return this.basePackage + "MessageResolverFactory";
}
- public String getCustomValidationStrategyFactory() {
+ public String getCustomValidationStrategyFactory()
+ {
return this.basePackage + "ValidationStrategyFactory";
}
@Deprecated
- public String getCustomConverterAdapterFactory() {
+ public String getCustomConverterAdapterFactory()
+ {
return this.basePackage + "ConverterAdapterFactory";
}
@@ -96,14 +114,16 @@
/*
* conventions (the rest of the conventions are built with the help of name mappers,...
*/
- public String getConventionForMessageBundle() {
+ public String getConventionForMessageBundle()
+ {
return this.basePackage + "validation_messages";
}
/*
* static strategy mappings (name of property files)
*/
- public String getCustomStaticStrategyMappingSource() {
+ public String getCustomStaticStrategyMappingSource()
+ {
return this.basePackage + "strategy_mappings";
}
@@ -113,54 +133,77 @@
* final methods
*/
//TODO
- public final String getConventionForModuleMessageBundle(String packageName) {
+ public final String getConventionForModuleMessageBundle(String packageName)
+ {
String newPackageName;
- if (packageName.endsWith(".resolver")) {
+ if (packageName.endsWith(".resolver"))
+ {
newPackageName = packageName.replace(".resolver", ".bundle");
- } else {
+ }
+ else
+ {
newPackageName = packageName.replace(".resolver.", ".bundle.");
}
return newPackageName + ".validation_messages";
}
- public final List<String> getStaticStrategyMappingSources() {
+ public final List<String> getStaticStrategyMappingSources()
+ {
return this.staticStrategyMappings;
}
- public final void addStaticStrategyMappingSource(String resourceBundleName) {
- synchronized (this) {
+ public final void addStaticStrategyMappingSource(String resourceBundleName)
+ {
+ synchronized (this)
+ {
this.staticStrategyMappings.add(resourceBundleName);
}
}
- public final boolean containsStaticStrategyMappingSource(String resourceBundleName) {
+ public final boolean containsStaticStrategyMappingSource(
+ String resourceBundleName)
+ {
return this.staticStrategyMappings.contains(resourceBundleName);
}
/**
* use a custom name mapper to implement custom conventions
*/
- public final String getConventionNameForMessageResolverPackage(Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName) {
+ public final String getConventionNameForMessageResolverPackage(
+ Class<? extends ValidationStrategy> validationStrategyClass,
+ String targetClassName)
+ {
String resolverName = validationStrategyClass.getName();
resolverName = resolverName.replace(".strategy.", ".message.resolver.");
- if (targetClassName == null) {
+ if (targetClassName == null)
+ {
//TODO
return null;
}
- return resolverName.substring(0, resolverName.lastIndexOf(".")) + "." + targetClassName;
+ return resolverName.substring(0, resolverName.lastIndexOf(".")) + "."
+ + targetClassName;
}
/**
* use a custom name mapper to implement custom conventions
*/
- public final String getConventionNameForMessageResolverClass(String strategyClassName) {
- if (strategyClassName.endsWith("ValidationStrategy")) {
- return strategyClassName.substring(0, strategyClassName.length() - 18) + "ValidationErrorMessageResolver";
- } else if (strategyClassName.endsWith("Strategy")) {
- return strategyClassName.substring(0, strategyClassName.length() - 8) + "ValidationErrorMessageResolver";
+ public final String getConventionNameForMessageResolverClass(
+ String strategyClassName)
+ {
+ if (strategyClassName.endsWith("ValidationStrategy"))
+ {
+ return strategyClassName.substring(0,
+ strategyClassName.length() - 18)
+ + "ValidationErrorMessageResolver";
+ }
+ else if (strategyClassName.endsWith("Strategy"))
+ {
+ return strategyClassName.substring(0,
+ strategyClassName.length() - 8)
+ + "ValidationErrorMessageResolver";
}
return strategyClassName;
}
@@ -168,7 +211,11 @@
/**
* use a custom name mapper to implement custom conventions
*/
- public final String getConventionNameForValidationStrategy(Annotation annotation) {
- return annotation.annotationType().getName().replace(".annotation.", ".strategy.") + "Strategy";
+ public final String getConventionNameForValidationStrategy(
+ Annotation annotation)
+ {
+ return annotation.annotationType().getName().replace(".annotation.",
+ ".strategy.")
+ + "Strategy";
}
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProcessedInformationEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProcessedInformationEntry.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProcessedInformationEntry.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProcessedInformationEntry.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -24,43 +24,53 @@
/**
* @author Gerhard Petracek
*/
-public class ProcessedInformationEntry {
+public class ProcessedInformationEntry
+{
private Object bean;
private Object convertedValue;
private UIComponent component;
- //for complex components (e.g. a table there are multiple entries with the same key (here the el expression #{entry.property})
+ //for complex components (e.g. a table there are multiple entries with
+ //the same key (here the el expression #{entry.property})
//however, don't override the previous entry - they arn't the same;
private List<ProcessedInformationEntry> furtherEntries;
- public Object getBean() {
+ public Object getBean()
+ {
return bean;
}
- public void setBean(Object bean) {
+ public void setBean(Object bean)
+ {
this.bean = bean;
}
- public Object getConvertedValue() {
+ public Object getConvertedValue()
+ {
return convertedValue;
}
- public void setConvertedValue(Object convertedValue) {
+ public void setConvertedValue(Object convertedValue)
+ {
this.convertedValue = convertedValue;
}
- public UIComponent getComponent() {
+ public UIComponent getComponent()
+ {
return component;
}
- public void setComponent(UIComponent component) {
+ public void setComponent(UIComponent component)
+ {
this.component = component;
}
- public List<ProcessedInformationEntry> getFurtherEntries() {
+ public List<ProcessedInformationEntry> getFurtherEntries()
+ {
return furtherEntries;
}
- public void setFurtherEntries(List<ProcessedInformationEntry> furtherEntries) {
+ public void setFurtherEntries(List<ProcessedInformationEntry> furtherEntries)
+ {
this.furtherEntries = furtherEntries;
}
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProxyMappingPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProxyMappingPhaseListener.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProxyMappingPhaseListener.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/ProxyMappingPhaseListener.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -40,66 +40,87 @@
*
* @author Gerhard Petracek
*/
-public class ProxyMappingPhaseListener implements PhaseListener {
+public class ProxyMappingPhaseListener implements PhaseListener
+{
private boolean isInitialized = false;
protected final Log logger = LogFactory.getLog(getClass());
- public void afterPhase(PhaseEvent event) {
- if (!isInitialized) {
+ public void afterPhase(PhaseEvent event)
+ {
+ if (!isInitialized)
+ {
//don't use DEACTIVATE_PROXY_MAPPING here to allow a different concept
String initParam = WebXmlParameter.DEACTIVATE_RESTORE_PROXY_PHASE_LISTENER;
- if(initParam != null && initParam.equalsIgnoreCase("true")) {
+ if (initParam != null && initParam.equalsIgnoreCase("true"))
+ {
ExtValUtils.deregisterPhaseListener(this);
}
isInitialized = true;
}
- if(!event.getPhaseId().equals(PhaseId.RENDER_RESPONSE)) {
+ if (!event.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+ {
return;
}
- Integer processedConverterCount = ExtValUtils.getProcessedConverterCount();
+ Integer processedConverterCount = ExtValUtils
+ .getProcessedConverterCount();
//don't change the comparison with 0 - in order to reduce the overhead.
//if everything works correctly it's not necessary to inspact the full tree
//it's just due to a ri bug - normally it's performed during ExtValConverter#intercept#getAsString
- if(ExtValUtils.useProxyMapping() && (processedConverterCount != null && !processedConverterCount.equals(0))){
- storeComponentConverterMappingForProxies(event.getFacesContext(), event.getFacesContext().getViewRoot());
+ if (ExtValUtils.useProxyMapping()
+ && (processedConverterCount != null && !processedConverterCount
+ .equals(0)))
+ {
+ storeComponentConverterMappingForProxies(event.getFacesContext(),
+ event.getFacesContext().getViewRoot());
}
}
- public void beforePhase(PhaseEvent event) {
- if(!event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES)) {
+ public void beforePhase(PhaseEvent event)
+ {
+ if (!event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+ {
return;
}
ExtValUtils.restoreProxies();
}
- public PhaseId getPhaseId() {
+ public PhaseId getPhaseId()
+ {
return PhaseId.ANY_PHASE;
}
/**
* there is a ri bug (at least with jsp's) -> sometimes getAsString of converters aren't called
- * -> there is no mapping -> if it's the case and there are unhandled editable value hoder components within the page
+ * -> there is no mapping -> if it's the case and there are
+ * unhandled editable value hoder components within the page
* -> search all these components and add the equivalent converter to the mapping
*
* @param facesContext reference to the current faces context
* @param uiComponent reference to the current component
*/
- private void storeComponentConverterMappingForProxies(FacesContext facesContext, UIComponent uiComponent) {
+ private void storeComponentConverterMappingForProxies(
+ FacesContext facesContext, UIComponent uiComponent)
+ {
//TODO use the following after the impl. of a better multi-window-mode solution
//if(!uiComponent.isRendered()) {
// return;
//}
-
- for(UIComponent child : uiComponent.getChildren()) {
- if(child instanceof ValueHolder) {
- Converter converter = ((ValueHolder)child).getConverter();
- if(converter != null && converter.getClass().getName().contains("$$")) {
- ExtValUtils.getOrInitProxyMapping().put(child.getClientId(facesContext), child);
+
+ for (UIComponent child : uiComponent.getChildren())
+ {
+ if (child instanceof ValueHolder)
+ {
+ Converter converter = ((ValueHolder) child).getConverter();
+ if (converter != null
+ && converter.getClass().getName().contains("$$"))
+ {
+ ExtValUtils.getOrInitProxyMapping().put(
+ child.getClientId(facesContext), child);
}
}
storeComponentConverterMappingForProxies(facesContext, child);
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core;
@@ -25,40 +25,57 @@
*
* @author Gerhard Petracek
*/
-public interface WebXmlParameter {
+public interface WebXmlParameter
+{
/*
* custom
*/
- static final String CUSTOM_MESSAGE_BUNDLE = WebXmlUtils.getInitParameter("CUSTOM_MESSAGE_BUNDLE");
- static final String CUSTOM_EXTENSION_BASE_PACKAGE = WebXmlUtils.getInitParameter("CUSTOM_BASE_PACKAGE");
- static final String CUSTOM_CONVENTION_INFO_PROVIDER_BEAN = WebXmlUtils.getInitParameter("CUSTOM_INFORMATION_PROVIDER_BEAN");
-
- static final String CUSTOM_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER = WebXmlUtils.getInitParameter("CUSTOM_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER");
- static final String CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER = WebXmlUtils.getInitParameter("CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER");
-
- static final String CUSTOM_MESSAGE_RESOLVER_FACTORY = WebXmlUtils.getInitParameter("CUSTOM_MESSAGE_RESOLVER_FACTORY");
- static final String CUSTOM_VALIDATION_STRATEGY_FACTORY = WebXmlUtils.getInitParameter("CUSTOM_VALIDATION_STRATEGY_FACTORY");
- static final String CUSTOM_ANNOTATION_EXTRACTOR_FACTORY = WebXmlUtils.getInitParameter("CUSTOM_ANNOTATION_EXTRACTOR_FACTORY");
+ static final String CUSTOM_MESSAGE_BUNDLE = WebXmlUtils
+ .getInitParameter("CUSTOM_MESSAGE_BUNDLE");
+ static final String CUSTOM_EXTENSION_BASE_PACKAGE = WebXmlUtils
+ .getInitParameter("CUSTOM_BASE_PACKAGE");
+ static final String CUSTOM_CONVENTION_INFO_PROVIDER_BEAN = WebXmlUtils
+ .getInitParameter("CUSTOM_INFORMATION_PROVIDER_BEAN");
+
+ static final String CUSTOM_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER");
+ static final String CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER");
+
+ static final String CUSTOM_MESSAGE_RESOLVER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_MESSAGE_RESOLVER_FACTORY");
+ static final String CUSTOM_VALIDATION_STRATEGY_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_VALIDATION_STRATEGY_FACTORY");
+ static final String CUSTOM_ANNOTATION_EXTRACTOR_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_ANNOTATION_EXTRACTOR_FACTORY");
- static final String CUSTOM_ANNOTATION_EXTRACTOR = WebXmlUtils.getInitParameter("CUSTOM_ANNOTATION_EXTRACTOR");
+ static final String CUSTOM_ANNOTATION_EXTRACTOR = WebXmlUtils
+ .getInitParameter("CUSTOM_ANNOTATION_EXTRACTOR");
//TODO documentation
- static final String CUSTOM_VALIDATIONSTRATEGY_MAPPING = WebXmlUtils.getInitParameter("CUSTOM_STATIC_VALIDATIONSTRATEGY_MAPPING");
+ static final String CUSTOM_VALIDATIONSTRATEGY_MAPPING = WebXmlUtils
+ .getInitParameter("CUSTOM_STATIC_VALIDATIONSTRATEGY_MAPPING");
/*
* deactivate
*/
- static final String DEACTIVATE_RESTORE_PROXY_PHASE_LISTENER = WebXmlUtils.getInitParameter("DEACTIVATE_RESTORE_PROXY_PHASE_LISTENER");
- static final String DEACTIVATE_DEFAULT_CONVENTION = WebXmlUtils.getInitParameter("DEACTIVATE_DEFAULT_CONVENTION");
- static final String DEACTIVATE_PROXY_MAPPING = WebXmlUtils.getInitParameter("DEACTIVATE_PROXY_MAPPING");
+ static final String DEACTIVATE_RESTORE_PROXY_PHASE_LISTENER = WebXmlUtils
+ .getInitParameter("DEACTIVATE_RESTORE_PROXY_PHASE_LISTENER");
+ static final String DEACTIVATE_DEFAULT_CONVENTION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_DEFAULT_CONVENTION");
+ static final String DEACTIVATE_PROXY_MAPPING = WebXmlUtils
+ .getInitParameter("DEACTIVATE_PROXY_MAPPING");
/*
* fallback lib - if the usage of cglib is a problem
*/
@Deprecated
- static final String CUSTOM_CONVERTER_TO_ADAPTER_NAME_MAPPER = WebXmlUtils.getInitParameter("CUSTOM_CONVERTER_TO_ADAPTER_NAME_MAPPER");
+ static final String CUSTOM_CONVERTER_TO_ADAPTER_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_CONVERTER_TO_ADAPTER_NAME_MAPPER");
@Deprecated
- static final String CUSTOM_CONVERTER_ADAPTER_FACTORY = WebXmlUtils.getInitParameter("CUSTOM_CONVERTER_ADAPTER_FACTORY");
+ static final String CUSTOM_CONVERTER_ADAPTER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_CONVERTER_ADAPTER_FACTORY");
@Deprecated
- static final String USE_ADAPTERS = WebXmlUtils.getInitParameter("USE_ADAPTERS");
+ static final String USE_ADAPTERS = WebXmlUtils
+ .getInitParameter("USE_ADAPTERS");
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/DefaultConverterAdapterFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/DefaultConverterAdapterFactory.java?rev=681422&r1=681421&r2=681422&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/DefaultConverterAdapterFactory.java (original)
+++ myfaces/extensions/validator/branches/trunk_layout_myfaces/core/src/main/java/org/apache/myfaces/extensions/validator/core/adapter/DefaultConverterAdapterFactory.java Thu Jul 31 10:28:59 2008
@@ -1,20 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.extensions.validator.core.adapter;
@@ -40,11 +40,14 @@
* @author Gerhard Petracek
*/
@Deprecated
-public class DefaultConverterAdapterFactory implements ClassMappingFactory<Converter, Converter> {
+public class DefaultConverterAdapterFactory implements
+ ClassMappingFactory<Converter, Converter>
+{
private static Map<String, String> converterAdapterMapping = new HashMap<String, String>();
private static List<NameMapper<Converter>> nameMapperList = new ArrayList<NameMapper<Converter>>();
- static {
+ static
+ {
nameMapperList.add(new CustomConfiguredConverterToAdapterNameMapper());
nameMapperList.add(new CustomConventionConverterToAdapterNameMapper());
nameMapperList.add(new DefaultConverterToAdapterNameMapper());
@@ -53,32 +56,42 @@
protected final Log logger = LogFactory.getLog(getClass());
- public Converter create(Converter converter) {
+ public Converter create(Converter converter)
+ {
String converterName = converter.getClass().getName();
- if (converterAdapterMapping.containsKey(converterName)) {
- return (Converter) ClassUtils.tryToInstantiateClassForName(converterAdapterMapping.get(converterName));
+ if (converterAdapterMapping.containsKey(converterName))
+ {
+ return (Converter) ClassUtils
+ .tryToInstantiateClassForName(converterAdapterMapping
+ .get(converterName));
}
Converter adapter;
String adapterName;
- for (NameMapper<Converter> nameMapper : nameMapperList) {
+ for (NameMapper<Converter> nameMapper : nameMapperList)
+ {
adapterName = nameMapper.createName(converter);
- adapter = (Converter) ClassUtils.tryToInstantiateClassForName(adapterName);
+ adapter = (Converter) ClassUtils
+ .tryToInstantiateClassForName(adapterName);
- if (adapter != null) {
+ if (adapter != null)
+ {
addMapping(converterName, adapter.getClass().getName());
return adapter;
}
}
- logger.debug("no adapter found for " + converterName + " -> converter itself is used -> no sev-en support");
+ logger.debug("no adapter found for " + converterName
+ + " -> converter itself is used -> no sev-en support");
return converter;
}
- private void addMapping(String sourceConverter, String adapter) {
- synchronized (DefaultConverterAdapterFactory.class) {
+ private void addMapping(String sourceConverter, String adapter)
+ {
+ synchronized (DefaultConverterAdapterFactory.class)
+ {
converterAdapterMapping.put(sourceConverter, adapter);
}
//TODO logging