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/08/09 22:13:51 UTC
svn commit: r684329 -
/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
Author: lu4242
Date: Sat Aug 9 13:13:51 2008
New Revision: 684329
URL: http://svn.apache.org/viewvc?rev=684329&view=rev
Log:
add param targetClass as on 1.2 branch
Modified:
myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java?rev=684329&r1=684328&r2=684329&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/EnumConverter.java Sat Aug 9 13:13:51 2008
@@ -1,19 +1,21 @@
/*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.commons.converter;
import org.apache.myfaces.commons.util.MessageUtils;
@@ -91,14 +93,14 @@
}
}
- private void checkTargetClass(FacesContext facesContext, UIComponent uiComponent, Object value) {
- if (targetClass == null) {
+ private void checkTargetClass(FacesContext facesContext, UIComponent uiComponent, Object value) {
+ if (targetClass == null) {
Object[] params = new Object[]{value, MessageUtils.getLabel(facesContext, uiComponent)};
throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
ENUM_NO_CLASS_ID,
params));
}
- }
+ }
// find the first constant value of the targetClass and return as a String
private String firstConstantOfEnum() {
@@ -124,5 +126,19 @@
public boolean isTransient() {
return isTransient;
}
-
+
+ /**
+ * The enum class to be used for this converter as reference
+ *
+ * @JSFProperty
+ */
+ public Class getTargetClass()
+ {
+ return targetClass;
+ }
+
+ public void setTargetClass(Class targetClass)
+ {
+ this.targetClass = targetClass;
+ }
}