app/src/main/java/com/treslines/pagsegurodemo/PagSeguroAddress.java
private void validate( final String street,  final String number, final String complement, final String district,  final String postalCode,  final String city,  final PagSeguroBrazilianStates state){
        if(street.isEmpty()){
            throw new IllegalArgumentException("Street can not be empty!");
        }
        if(street.length()>80){
            throw new IllegalArgumentException("Street length can not exceed 80 characters!");
        }
        if(number.isEmpty()){
            this.number="N/A";
        }
        if(number.length()>20){
            throw new IllegalArgumentException("Number length can not exceed 20 characters!");
        }

        if(complement.isEmpty()){
            this.complement="";
        }
        if(complement.length()>40){
            throw new IllegalArgumentException("Complement length can not exceed 40 characters!");
        }

        if(district.isEmpty()){
            throw new IllegalArgumentException("District/neighborhood can not be empty!");
        }
        if(district.length()>60){
            throw new IllegalArgumentException("District/neighborhood length can not exceed 60 characters!");
        }

        if(postalCode.isEmpty()){
            throw new IllegalArgumentException("Postal code can not be empty!");
        }
        if(postalCode.length()!=8){
            throw new IllegalArgumentException("Postal code must have exactly 8 digits!");
        }
        try {
            Double.valueOf(postalCode);
        }catch (Exception e){
            throw new IllegalArgumentException("Postal code must be composed of digits only!");
        }
    }
/** validation defined acc. to pagseguro's web documentation */
validation defined acc. to pagseguro's web documentation
validation defined acc . to pagseguro ' s web documentation
private void validate( final String street,  final String number, final String complement, final String district,  final String postalCode,  final String city,  final PagSeguroBrazilianStates state){
        if(street.isEmpty()){
            throw new IllegalArgumentException("Street can not be empty!");
        }
        if(street.length()>80){
            throw new IllegalArgumentException("Street length can not exceed 80 characters!");
        }
        if(number.isEmpty()){
            this.number="N/A";
        }
        if(number.length()>20){
            throw new IllegalArgumentException("Number length can not exceed 20 characters!");
        }
        if(complement.isEmpty()){
            this.complement="";
        }
        if(complement.length()>40){
            throw new IllegalArgumentException("Complement length can not exceed 40 characters!");
        }
        if(district.isEmpty()){
            throw new IllegalArgumentException("District/neighborhood can not be empty!");
        }
        if(district.length()>60){
            throw new IllegalArgumentException("District/neighborhood length can not exceed 60 characters!");
        }
        if(postalCode.isEmpty()){
            throw new IllegalArgumentException("Postal code can not be empty!");
        }
        if(postalCode.length()!=8){
            throw new IllegalArgumentException("Postal code must have exactly 8 digits!");
        }
        try {
            Double.valueOf(postalCode);
        }catch (Exception e){
            throw new IllegalArgumentException("Postal code must be composed of digits only!");
        }
    }
private void validate ( final String street , final String number , final String complement , final String district , final String postalCode , final String city , final PagSeguroBrazilianStates state ) { if ( street . isEmpty ( ) ) { throw new IllegalArgumentException ( "Street can not be empty!" ) ; } if ( street . length ( ) > 80 ) { throw new IllegalArgumentException ( "Street length can not exceed 80 characters!" ) ; } if ( number . isEmpty ( ) ) { this . number = "N/A" ; } if ( number . length ( ) > 20 ) { throw new IllegalArgumentException ( "Number length can not exceed 20 characters!" ) ; } if ( complement . isEmpty ( ) ) { this . complement = "" ; } if ( complement . length ( ) > 40 ) { throw new IllegalArgumentException ( "Complement length can not exceed 40 characters!" ) ; } if ( district . isEmpty ( ) ) { throw new IllegalArgumentException ( "District/neighborhood can not be empty!" ) ; } if ( district . length ( ) > 60 ) { throw new IllegalArgumentException ( "District/neighborhood length can not exceed 60 characters!" ) ; } if ( postalCode . isEmpty ( ) ) { throw new IllegalArgumentException ( "Postal code can not be empty!" ) ; } if ( postalCode . length ( ) != 8 ) { throw new IllegalArgumentException ( "Postal code must have exactly 8 digits!" ) ; } try { Double . valueOf ( postalCode ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Postal code must be composed of digits only!" ) ; } }
validation defined acc.
validation defined acc .