uk.co.lakesidetech.spxforms.web.servlet.support
Class SpXBindStatus

java.lang.Object
  extended byuk.co.lakesidetech.spxforms.web.servlet.support.SpXBindStatus

public class SpXBindStatus
extends java.lang.Object

Author:
Stuart Eccles

Constructor Summary
SpXBindStatus(org.springframework.web.servlet.support.RequestContext requestContext, java.lang.String path, boolean htmlEscape)
          Create a new SpXBindStatus instance, representing a field or object status.
 
Method Summary
 java.lang.String getDisplayValue()
          Return a suitable display value for the field, i.e.
 java.lang.String getErrorCode()
          Return the first error codes for the field or object, if any.
 java.lang.String[] getErrorCodes()
          Return the error codes for the field or object, if any.
 java.lang.String getErrorMessage()
          Return the first error message for the field or object, if any.
 java.lang.String[] getErrorMessages()
          Return the resolved error messages for the field or object, if any.
 java.lang.String getErrorMessagesAsString(java.lang.String delimiter)
          Return an error message string, concatenating all messages separated by the given delimiter.
 org.springframework.validation.Errors getErrors()
          Return the Errors instance that this bind status is currently bound to.
 java.lang.String getExpression()
          Return a bind expression that can be used in HTML forms as input name for the respective field, or null if not field-specific.
 int getNodeSetCount()
          Return the nodeset count of the current field path
 java.lang.String getPath()
          Return the bean and property path for which values and errors will be resolved (e.g.
 java.lang.Object getValue()
          Return the current value of the field, i.e.
 boolean isError()
          Return if this status represents a field or object error.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpXBindStatus

public SpXBindStatus(org.springframework.web.servlet.support.RequestContext requestContext,
                     java.lang.String path,
                     boolean htmlEscape)
              throws java.lang.IllegalStateException
Create a new SpXBindStatus instance, representing a field or object status.

Parameters:
requestContext - the current RequestContext
path - the bean and property path for which values and errors will be resolved (e.g. "customer/address/street")
htmlEscape - whether to HTML-escape error messages and string values
Throws:
java.lang.IllegalStateException - if no corresponding Errors object found
Method Detail

getPath

public java.lang.String getPath()
Return the bean and property path for which values and errors will be resolved (e.g. "customer.address.street").


getExpression

public java.lang.String getExpression()
Return a bind expression that can be used in HTML forms as input name for the respective field, or null if not field-specific.

Returns a bind path appropriate for resubmission, e.g. "address.street". Note that the complete bind path as required by the bind tag is "customer.address.street", if bound to a "customer" bean.


getValue

public java.lang.Object getValue()
Return the current value of the field, i.e. either the property value or a rejected update, or null if not field-specific.


getNodeSetCount

public int getNodeSetCount()
Return the nodeset count of the current field path


getDisplayValue

public java.lang.String getDisplayValue()
Return a suitable display value for the field, i.e. empty string instead of a null value, or null if not field-specific.


isError

public boolean isError()
Return if this status represents a field or object error.


getErrorCodes

public java.lang.String[] getErrorCodes()
Return the error codes for the field or object, if any. Returns an empty array instead of null if none.


getErrorCode

public java.lang.String getErrorCode()
Return the first error codes for the field or object, if any.


getErrorMessages

public java.lang.String[] getErrorMessages()
Return the resolved error messages for the field or object, if any. Returns an empty array instead of null if none.


getErrorMessage

public java.lang.String getErrorMessage()
Return the first error message for the field or object, if any.


getErrorMessagesAsString

public java.lang.String getErrorMessagesAsString(java.lang.String delimiter)
Return an error message string, concatenating all messages separated by the given delimiter.

Parameters:
delimiter - separator string, e.g. ", " or "
"
Returns:
the error message string

getErrors

public org.springframework.validation.Errors getErrors()
Return the Errors instance that this bind status is currently bound to.

Returns:
the current Errors instance, or null if none

toString

public java.lang.String toString()