Previous Section  < Day Day Up >  Next Section

D.4 Package javax.faces.convert

BigDecimalConverter

An instance of this class is used as a Converter for java.math.BigDecimal values.

Synopsis

Class name:

javax.faces.convert.BigDecimalConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.BigDecimal.

Constructors


public BigDecimalConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a BigDecimal instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context,javax.faces.component.UIComponent component, Object value)

Converts the provided BigDecimal value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

BigIntegerConverter

An instance of this class is used as a Converter for java.math.BigInteger values.

Synopsis

Class name:

javax.faces.convert.BigIntegerConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.BigInteger.

Constructors


public BigIntegerConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a BigInteger instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided BigInteger value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

BooleanConverter

An instance of this class is used as a Converter for Boolean values.

Synopsis

Class name:

javax.faces.convert.BooleanConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Boolean.

Constructors


public BooleanConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Boolean instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Boolean value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

ByteConverter

An instance of this class is used as a Converter for Byte values.

Synopsis

Class name:

javax.faces.convert.ByteConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Byte.

Constructors


public ByteConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Byte instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Byte value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

CharacterConverter

An instance of this class is used as a Converter for Character values.

Synopsis

Class name:

javax.faces.convert.CharacterConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Character.

Constructors


public CharacterConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Character instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Character value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

Converter

This interface is implemented by all converter classes, converting between a String value and a data type supported by the class.

Synopsis

Interface name:

javax.faces.convert.Converter

Extends:

None

Implemented by:

All standard and custom converters.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to an instance of the supported type and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided value of the supported type (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

ConverterException

An instance of this class is thrown by a Converter implementation to signal a conversion error.

Synopsis

Class name:

javax.faces.convert.ConverterException

Extends:

javax.faces.FacesException

Implements:

java.io.Serializable

Constructors


public ConverterException()

Creates an empty instance.


public ConverterException(java.faces.application.FacesMessage message)

Creates an instance with the specified message.


public ConverterException(java.faces.application.FacesMessage message, Throwable rootCause)

Creates an instance with the specified message and root cause.


public ConverterException(String message)

Creates an instance with the specified message text.


public ConverterException(String message, Throwable rootCause)

Creates an instance with the specified message text and root cause.


public ConverterException(Throwable rootCause)

Creates an instance with the specified root cause.

Methods


public java.faces.application.FacesMessage getFacesMessage()

Returns the FacesMessage instance or null if none is set.

DateTimeConverter

An instance of this class is used as a Converter for java.util.Date values.

Synopsis

Class name:

javax.faces.convert.DateTimeConverter

Extends:

None

Implements:

javax.faces.convert.Converter, javax.faces.component.StateHolder

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.DateTime.

Constructors


public DateTimeConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Date instance and returns the new instance. Returns null if the value is null or an empty string (after trimming); otherwise, parses the value in the same way as java.text.SimpleDateFormat in nonlenient mode, guided by the dateStyle, pattern, timeStyle, timeZone and type property value for the Locale specified by the locale property or the view's Locale. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Date value (which can be null) to a String instance and returns the new instance, formatted in the same way as by java.text.SimpleDateFormat, guided by the dateStyle, pattern, timeStyle, timeZone, and type properties for the Locale specified by the locale property or the view's Locale. Throws a ConverterException if the conversion fails.


public String getDateStyle()

Returns the dateStyle property value.


public java.util.Locale getLocale()

Returns the locale property value.


public String getPattern()

Returns the pattern property value.


public String getTimeStyle()

Returns the timeStyle property value.


public java.util.TimeZone getTimeZone()

Returns the timeZone property value.


public String getType()

Returns the type property value.


public boolean isTransient()

Returns true if no state should be saved and restored for this instance.


public void restoreState(javax.faces.context.FacesContext context, Object state)

Restores the state for this instance from the provided value; an Object previously returned by the saveState() method.


public Object saveState(javax.faces.context.FacesContext context)

Returns the state for this instance as an Object to be passed to the restoreState() method when the instance is restored for the next request.


public void setDateStyle(String dateStyle)

Sets the dateStyle property value.


public void setLocale(java.util.Locale locale)

Sets the locale property value.


public void setPattern(String pattern)

Sets the pattern property value.


public void setTimeStyle(String timeStyle)

Sets the timeStyle property value.


public void setTimeZone(java.util.TimeZone timeZone)

Sets the timeZone property value.


public void setTransient(boolean isTransient)

Sets the transient property value.


public void setType(String type)

Sets the type property value.

DoubleConverter

An instance of this class is used as a Converter for Double values.

Synopsis

Class name:

javax.faces.convert.DoubleConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Double.

Constructors


public DoubleConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Double instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Double value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

FloatConverter

An instance of this class is used as a Converter for Float values.

Synopsis

Class name:

javax.faces.convert.FloatConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Float.

Constructors


public FloatConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Float instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Float value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

IntegerConverter

An instance of this class is used as a Converter for Integer values.

Synopsis

Class name:

javax.faces.convert.IntegerConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Integer.

Constructors


public IntegerConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to an Integer instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Integer value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

LongConverter

An instance of this class is used as a Converter for Long values.

Synopsis

Class name:

javax.faces.convert.LongConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Long.

Constructors


public LongConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Long instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Long value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

NumberConverter

An instance of this class is used as a Converter for Double and Long values.

Synopsis

Class name:

javax.faces.convert.NumberConverter

Extends:

None

Implements:

javax.faces.convert.Converter, javax.faces.component.StateHolder

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Number.

Constructors


public NumberConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Number instance and returns the new instance. Returns null if the value is null or an empty string (after trimming); otherwise, parses the value in the same way as java.text.DecimalFormat, guided by the component's pattern, integerOnly and type attributes for the Locale specified by the component's locale attribute or the view's Locale. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Number value (which can be null) to a String instance and returns the new instance, formatted in the same way as by java.text.DecimalFormat, guided by the component's pattern, currencyCode, currencySymbol, groupingUsed, maxIntegerDigits, minIntegerDisgits, maxFractionDigits, minFractionDigits, and type attributes for the Locale specified by the component's locale attribute or the view's Locale. Throws a ConverterException if the conversion fails.


public String getCurrencyCode()

Returns the currencyCode property value.


public String getCurrencySymbol()

Returns the currencySymbol property value.


public java.util.Locale getLocale()

Returns the locale property value.


public int getMaxFractionDigits()

Returns the maxFractionDigits property value.


public int getMaxIntegerDigits()

Returns the maxIntegerDigits property value.


public int getMinFractionDigits()

Returns the minFractionDigits property value.


public int getMinIntegerDigits()

Returns the minIntegerDigits property value.


public String getPattern()

Returns the pattern property value.


public String getType()

Returns the type property value.


public boolean isGroupingUsed()

Returns the groupingUsed property value.


public boolean isIntegerOnly()

Returns the isIntegerOnly property value.


public boolean isTransient()

Returns true if no state should be saved and restored for this instance.


public void restoreState(javax.faces.context.FacesContext context, Object state)

Restores the state for this instance from the provided value; an Object previously returned by the saveState() method.


public Object saveState(javax.faces.context.FacesContext context)

Returns the state for this instance as an Object to be passed to the restoreState() method when the instance is restored for the next request.


public void setCurrencyCode(String currencyCode)

Sets the currencyCode property value.


public void setCurrencySymbol(String currencySymbol)

Sets the currencySymbol property value.


public void setGroupingUsed(boolean groupingUsed)

Sets the groupingUsed property value.


public void setIntegerOnly(boolean integerOnly)

Sets the isIntegerOnly property value.


public void setLocale(java.util.Locale locale)

Sets the locale property value.


public void setMaxFractionDigits(int maxFractionDigits)

Sets the maxFractionDigits property value.


public void setMaxIntegerDigits(int maxIntegerDigits)

Sets the maxIntegerDigits property value.


public void setMinFractionDigits(int minFractionDigits)

Sets the minFractionDigits property value.


public void setMinIntegerDigits(int minIntegerDigits)

Sets the minIntegerDigits property value.


public void setPattern(String pattern)

Sets the pattern property value.


public void setTransient(boolean isTransient)

Sets the transient property value.


public void setType(String type)

Sets the type property value.

ShortConverter

An instance of this class is used as a Converter for Short values.

Synopsis

Class name:

javax.faces.convert.ShortConverter

Extends:

None

Implements:

javax.faces.convert.Converter

Fields


public static final String CONVERTER_ID

The identifier for this converter: javax.faces.Short.

Constructors


public ShortConverter()

Creates an instance.

Methods


public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Short instance and returns the new instance. Throws a ConverterException if the conversion fails.


public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Short value (which can be null) to a String instance and returns the new instance. Throws a ConverterException if the conversion fails.

    Previous Section  < Day Day Up >  Next Section