Android Open Source - simple-dash Validators






From Project

Back to project page simple-dash.

License

The source code is released under:

MIT License

If you think the Android project simple-dash listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.bmdtech.simpledash.utils;
/*  ww w. j  a va 2s  .  c  om*/
import org.apache.commons.validator.routines.InetAddressValidator;

public class Validators {

    public static boolean validIpAddress(String ipAddress) {
        if (isBlank(ipAddress)) {
            return false;
        }

        return InetAddressValidator.getInstance().isValid(ipAddress);
    }

    public static boolean validInteger(String stringRepresentation, Integer minValue, Integer maxValue) {
        if (isBlank(stringRepresentation)) {
            return false;
        }

        try {
            Integer number = Integer.valueOf(stringRepresentation);

            return number >= minValue && number <= maxValue;
        } catch (NumberFormatException e) {
            return false;
        }
    }

    public static boolean isBlank(String string) {
        return string == null || string.trim().length() == 0;
    }
}




Java Source Code List

org.bmdtech.simpledash.SimpleDashApp.java
org.bmdtech.simpledash.activity.MainActivity.java
org.bmdtech.simpledash.activity.SettingsActivity.java
org.bmdtech.simpledash.activity.UpdatableActivity.java
org.bmdtech.simpledash.event.BaseEvent.java
org.bmdtech.simpledash.event.ConnectivityEvent.java
org.bmdtech.simpledash.event.TelemetryEvent.java
org.bmdtech.simpledash.handler.AndroidMessageHandler.java
org.bmdtech.simpledash.telemetry.TelemetryConnector.java
org.bmdtech.simpledash.utils.Logging.java
org.bmdtech.simpledash.utils.SpeedUnit.java
org.bmdtech.simpledash.utils.Validators.java