org.apache.myfaces.custom.convertStringUtils
Class StringUtilsConverter

java.lang.Object
  extended by org.apache.myfaces.custom.convertStringUtils.StringUtilsConverter
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter

public class StringUtilsConverter
extends java.lang.Object
implements javax.faces.convert.Converter, javax.faces.component.StateHolder

Converts the format of a string

Converter which modifies a string by changing the input text into upper case, lower case, capitalized. The input string can be optionally trimmed and truncated at some max length. Ellipses (...) can be added to a truncated string.

Provides runtime modification of a string. Uses Apache Lang StringUtils and WordUtils to peform operations.

Author:
Julian Ray

Field Summary
protected  boolean _transient
           
protected  java.lang.Boolean appendEllipsesDuringInput
           
protected  java.lang.Boolean appendEllipsesDuringOutput
           
static java.lang.String CONVERTER_ID
           
protected  java.lang.String format
           
protected  java.lang.Integer maxLength
           
protected  java.lang.Boolean trim
           
 
Constructor Summary
StringUtilsConverter()
           
 
Method Summary
 java.lang.Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String value)
           
 java.lang.String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
           
 java.lang.String getFormat()
          Specifies the output case of the string.
 java.lang.Integer getMaxLength()
          Integer value for the maximum length of the rendered string.
 java.lang.Boolean getTrim()
          Boolean value determining is the string should be trimmed before any other formatting takes place.
 java.lang.Boolean isAppendEllipsesDuringInput()
          Boolean value determining if data should be truncated with ellipses during input conversion.
 java.lang.Boolean isAppendEllipsesDuringOutput()
          Boolean value determining if data should be truncated with ellipses during output conversion.
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAppendEllipsesDuringInput(java.lang.Boolean appendEllipsesDuringInput)
           
 void setAppendEllipsesDuringOutput(java.lang.Boolean appendEllipsesDuringOutput)
           
 void setFormat(java.lang.String format)
           
 void setMaxLength(java.lang.Integer maxLength)
           
 void setTransient(boolean _transient)
           
 void setTrim(java.lang.Boolean trim)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERTER_ID

public static final java.lang.String CONVERTER_ID
See Also:
Constant Field Values

_transient

protected boolean _transient

format

protected java.lang.String format

trim

protected java.lang.Boolean trim

maxLength

protected java.lang.Integer maxLength

appendEllipsesDuringOutput

protected java.lang.Boolean appendEllipsesDuringOutput

appendEllipsesDuringInput

protected java.lang.Boolean appendEllipsesDuringInput
Constructor Detail

StringUtilsConverter

public StringUtilsConverter()
Method Detail

getAsObject

public java.lang.Object getAsObject(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.String value)
                             throws javax.faces.convert.ConverterException
Specified by:
getAsObject in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException

getAsString

public java.lang.String getAsString(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.Object value)
                             throws javax.faces.convert.ConverterException
Specified by:
getAsString in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean _transient)
Specified by:
setTransient in interface javax.faces.component.StateHolder

getFormat

public java.lang.String getFormat()
Specifies the output case of the string. One of uppercase | lowercase | capitalize


setFormat

public void setFormat(java.lang.String format)

getMaxLength

public java.lang.Integer getMaxLength()
Integer value for the maximum length of the rendered string. Strings longer than maxValue will be truncated at (maxValue - 3) and an ellipsis '...' will be appended.


setMaxLength

public void setMaxLength(java.lang.Integer maxLength)

isAppendEllipsesDuringOutput

public java.lang.Boolean isAppendEllipsesDuringOutput()
Boolean value determining if data should be truncated with ellipses during output conversion. Default = false


setAppendEllipsesDuringOutput

public void setAppendEllipsesDuringOutput(java.lang.Boolean appendEllipsesDuringOutput)

isAppendEllipsesDuringInput

public java.lang.Boolean isAppendEllipsesDuringInput()
Boolean value determining if data should be truncated with ellipses during input conversion. Default = false


setAppendEllipsesDuringInput

public void setAppendEllipsesDuringInput(java.lang.Boolean appendEllipsesDuringInput)

getTrim

public java.lang.Boolean getTrim()
Boolean value determining is the string should be trimmed before any other formatting takes place. Default = false


setTrim

public void setTrim(java.lang.Boolean trim)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.