FileDocCategorySizeDatePackage
ConstraintUtils.javaAPI DocGlassfish v2 API4719Fri May 04 22:34:58 BST 2007com.sun.enterprise.tools.common.validation.constraints

ConstraintUtils

public class ConstraintUtils extends Object
ConstraintUtils is an Object providing the Utilities. formatFailureMessage methods, are the utility methods to format the failure messages. These Methods are used to format failure messages. Method print is the utility method to print this Object
author
Rajeshwar Patil
version
%I%, %G%

Fields Summary
Constructors Summary
ConstraintUtils()
Creates a new instance of ConstraintUtils

    
Methods Summary
java.lang.StringformatFailureMessage(java.lang.String constraint, java.lang.String value, java.lang.String name)
Formats the failure message from the given information.

param
constraint the failed Constraint name
param
value the value the constriant failed for
param
name the name of the value the constriant failed for
return
the formatted failure message

        String failureMessage = null;
        if(!((constraint == null) || (constraint.length() == 0) ||
            (value == null) || (name == null) || (name.length() == 0))){

            String format = BundleReader.getValue("MSG_Failure");       //NOI18N
            Object[] arguments = new Object[]{constraint, value, name};

            failureMessage = MessageFormat.format(format, arguments);
        }
        return failureMessage;
    
java.lang.StringformatFailureMessage(java.lang.String constraint, java.lang.String name)
Formats the failure message from the given information.

param
constraint the failed Constraint name
param
name the name of the element, the constriant failed for
return
the formatted failure message

        String failureMessage = null;
        if(!((constraint == null) || (constraint.length() == 0) ||
                (name == null) || (name.length() == 0))){

            String format = BundleReader.getValue("MSG_Failure_1");     //NOI18N
            Object[] arguments = new Object[]{constraint, name};

            failureMessage = MessageFormat.format(format, arguments);
        }
        return failureMessage;
    
voidprint()
Prints this Object

        String format = BundleReader.getValue("Name_Value_Pair_Format");//NOI18N
        Object[] arguments = new Object[]{"Constraint", this};          //NOI18N
        System.out.println(MessageFormat.format(format, arguments));