Package org.jpos.iso

Class ISOFieldValidator

    • Field Detail

      • description

        protected java.lang.String description
        brief field description
      • fieldId

        protected int fieldId
        field id
      • minLen

        protected int minLen
        field length bounds
      • maxLen

        protected int maxLen
        field length bounds
      • breakOnError

        protected boolean breakOnError
        Flag used to indicate if validat process break on first error or keep an error vector
    • Constructor Detail

      • ISOFieldValidator

        public ISOFieldValidator​(int maxLen,
                                 java.lang.String Description)
      • ISOFieldValidator

        public ISOFieldValidator​(int minLen,
                                 int maxLen,
                                 java.lang.String Description)
      • ISOFieldValidator

        public ISOFieldValidator​(boolean breakOnError,
                                 int minLen,
                                 int maxLen,
                                 java.lang.String Description)
      • ISOFieldValidator

        public ISOFieldValidator​(boolean breakOnError,
                                 int maxLen,
                                 java.lang.String Description)
      • ISOFieldValidator

        public ISOFieldValidator​(boolean breakOnError,
                                 java.lang.String Description)
      • ISOFieldValidator

        public ISOFieldValidator​(boolean breakOnError)
        Create a validator instance specifying breaking if any error during validation process id found.
        Parameters:
        breakOnError - break condition
    • Method Detail

      • setDescription

        public void setDescription​(java.lang.String description)
      • getRejCode

        public java.lang.String getRejCode​(int ErrType)
        Get the reject code for an error type. At this level is empty. It must be redefined by childs if it is necessary return an error code for specific errors. ISOVError.ERR_INVALID_LENGTH and ISOVErro.ERR_INVALID_VALUE are the defaults.
        Parameters:
        ErrType - Key for error type.
        Returns:
        the related error code. At this level return null.
      • validate

        public ISOComponent validate​(ISOComponent c)
                              throws ISOException
        Validate a field component. Default for fields only consider field length validations.
        Specified by:
        validate in interface ISOValidator
        Parameters:
        c - ISOField component
        Returns:
        an ISOComponent result of validation process. If there area any validation error, then an ISOV component replace original c and it's returned in case of break-on-error condition is false. If break-on-error is false, then an ISOVException containing the ISOV component is raised.
        Throws:
        ISOException - if there are some errors during validation. It contains an ISOV component inside referencing the errors.