|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.faces.convert Class EnumConverter
java.lang.Objectjavax.faces.convert.EnumConverter
- 所有已实现的接口:
- StateHolder, Converter
public class EnumConverter
- extends Object
- implements Converter, StateHolder
Converter implementation for java.lang.Enum
(and enum primitive) values.
- 从以下版本开始:
- 1.2
| 字段摘要 | |
|---|---|
static String |
CONVERTER_ID
The standard converter id for this converter. |
static String |
ENUM_ID
The message identifier of the FacesMessage to be created if
the conversion to Enum fails. |
static String |
ENUM_NO_CLASS_ID
The message identifier of the FacesMessage to be created if
the conversion to Enum fails and no target class has been
provided. |
| 构造器摘要 | |
|---|---|
EnumConverter()
|
|
EnumConverter(Class targetClass)
|
|
| 方法摘要 | |
|---|---|
Object |
getAsObject(FacesContext context,
UIComponent component,
String value)
Convert the value argument to one of the enum
constants of the class provided in our constructor. |
String |
getAsString(FacesContext context,
UIComponent component,
Object value)
Convert the enum constant given by the value
argument into a String. |
boolean |
isTransient()
If true, the Object implementing this interface must not participate in state saving or restoring. |
void |
restoreState(FacesContext facesContext,
Object object)
Perform any processing required to restore the state from the entries in the state Object. |
Object |
saveState(FacesContext facesContext)
Gets the state of the instance as a Serializable Object. |
void |
setTransient(boolean b)
Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring. |
| 类方法继承 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
CONVERTER_ID
public static final String CONVERTER_ID
The standard converter id for this converter.
- 另请参见:
- 常量字段
ENUM_ID
public static final String ENUM_ID
The message identifier of the
FacesMessageto be created if the conversion toEnumfails. The message format string for this message may optionally include the following placeholders:{0}replaced by the unconverted value.{1}replaced by one of the enum constants or the empty string if none can be found.{2}replaced by aStringwhose value is the label of the input component that produced this message.
- 另请参见:
- 常量字段
ENUM_NO_CLASS_ID
public static final String ENUM_NO_CLASS_ID
The message identifier of the
FacesMessageto be created if the conversion toEnumfails and no target class has been provided. The message format string for this message may optionally include the following placeholders:{0}replaced by the unconverted value.{1}replaced by aStringwhose value is the label of the input component that produced this message.
- 另请参见:
- 常量字段
| 构造器详细信息 |
|---|
EnumConverter
public EnumConverter()
EnumConverter
public EnumConverter(Class targetClass)
| 方法详细信息 |
|---|
getAsObject
public Object getAsObject(FacesContext context, UIComponent component, String value)
Convert the
valueargument to one of the enum constants of the class provided in our constructor. If no target class argument has been provided to the constructor of this instance, throw aConverterExceptioncontaining theENUM_NO_CLASS_IDmessage with proper parameters. If thevalueargument isnullor it has a length of zero, returnnull. Otherwise, perform the equivalent ofEnum.valueOfusing target class andvalueand return theObject. If the conversion fails, throw aConverterExceptioncontaining theENUM_IDmessage with proper parameters.- 规范说明:
getAsObjectin interfaceConverter
- 参数:
context- theFacesContextfor this request.component- theUIComponentto which this value will be applied.value- the Stringvalueto be converted toObject.- 返回:
nullif the value to convert isnull, otherwise the result of the conversion- 抛出异常:
ConverterException- if conversion cannot be successfully performedNullPointerException- ifcontextorcomponentisnull
getAsString
public String getAsString(FacesContext context, UIComponent component, Object value)
Convert the enum constant given by the
valueargument into a String. If no target class argument has been provided to the constructor of this instance, throw aConverterExceptioncontaining theENUM_NO_CLASS_IDmessage with proper parameters. If thevalue,/code> argument isnull, returnnull. If the value is an instance of the provided target class, return its string value (value.toString()). Otherwise, throw aConverterExceptioncontaining theENUM_IDmessage with proper parameters.- 规范说明:
getAsStringin interfaceConverter
- 参数:
context-FacesContextfor the request being processedcomponent-UIComponentwith which this model object value is associatedvalue- Model object value to be converted (may benull)- 返回:
- a zero-length String if value is
null, otherwise the result of the conversion - 抛出异常:
ConverterException- if conversion cannot be successfully performedNullPointerException- ifcontextorcomponentisnull
restoreState
public void restoreState(FacesContext facesContext, Object object)
- Description copied from interface:
StateHolder Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)method on all those instances as well.- 规范说明:
restoreStatein interfaceStateHolder
saveState
public Object saveState(FacesContext facesContext)
- Description copied from interface:
StateHolder Gets the state of the instance as a
SerializableObject.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.saveState(javax.faces.context.FacesContext)method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManagerThis method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
componentshould be the same as before executing it.The return from this method must be
Serializable- 规范说明:
saveStatein interfaceStateHolder
setTransient
public void setTransient(boolean b)
- Description copied from interface:
StateHolder Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- 规范说明:
setTransientin interfaceStateHolder
- 参数:
b- boolean passtrueif this Object will participate in state saving or restoring, otherwise passfalse.
isTransient
public boolean isTransient()
- Description copied from interface:
StateHolder If true, the Object implementing this interface must not participate in state saving or restoring.
- 规范说明:
isTransientin interfaceStateHolder
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.
javax.faces.convert.EnumConverter