jp.gopay.sdk.models.common.Domain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gopay-java-sdk Show documentation
Show all versions of gopay-java-sdk Show documentation
Official Gyro-n Payments Java SDK
package jp.gopay.sdk.models.common;
import jp.gopay.sdk.utils.TextUtils;
/**
* This class ensures that domains associated to application tokens satisfy the requirements by the API.
*/
public class Domain {
private static String ANY_DOMAIN_WILDCARD = "*";
public static Domain ANY = new Domain(ANY_DOMAIN_WILDCARD);
private String domain;
public Domain(String domain){
if((domain.equals(ANY_DOMAIN_WILDCARD)) | TextUtils.URLRegexVerifier(domain)){
this.domain = domain;
}
else{
throw new IllegalArgumentException(String.format("'%s' is not a valid domain",domain));
}
}
public boolean isEmpty(){
return domain.isEmpty();
}
public String asString() {
return domain;
}
}