本文整理汇总了Java中org.apache.commons.validator.routines.InetAddressValidator.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java InetAddressValidator.getInstance方法的具体用法?Java InetAddressValidator.getInstance怎么用?Java InetAddressValidator.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.validator.routines.InetAddressValidator
的用法示例。
在下文中一共展示了InetAddressValidator.getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidIp4
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp4(final String ip) {
if (ip == null) {
return false;
}
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet4Address(ip);
}
示例2: isValidIp6
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp6(final String ip) {
if (ip == null) {
return false;
}
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet6Address(ip);
}
示例3: isValidDomain
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
/**
* Returns true if the domain component of an email address is valid.
* @param domain being validated.
* @return true if the email address's domain is valid.
*/
protected boolean isValidDomain(String domain) {
boolean symbolic = false;
// see if domain is an IP address in brackets
MatchResult ipDomainMatcher = IP_DOMAIN_PATTERN.exec(domain);
if (ipDomainMatcher != null) {
InetAddressValidator inetAddressValidator =
InetAddressValidator.getInstance();
if (inetAddressValidator.isValid(ipDomainMatcher.getGroup(1))) {
return true;
}
} else {
// Domain is symbolic name
symbolic = (DOMAIN_PATTERN.exec(domain) != null);
}
if (symbolic) {
if (!isValidSymbolicDomain(domain)) {
return false;
}
} else {
return false;
}
return true;
}
示例4: isValidIp4
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp4(final String ip) {
if (ip == null)
return false;
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet4Address(ip);
}
示例5: isValidIp6
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
public static boolean isValidIp6(final String ip) {
if (ip == null)
return false;
final InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValidInet6Address(ip);
}
示例6: createArgs
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
@Override protected ImmutableList<String> createArgs() {
List<String> argList = new ArrayList<>();
checkAppiumJS();
argList.add(appiumJS.getAbsolutePath());
argList.add("--port");
argList.add(String.valueOf(getPort()));
if (StringUtils.isBlank(ipAddress)) {
ipAddress = DEFAULT_LOCAL_IP_ADDRESS;
} else {
InetAddressValidator validator = InetAddressValidator.getInstance();
if (!validator.isValid(ipAddress) && !validator.isValidInet4Address(ipAddress)
&& !validator.isValidInet6Address(ipAddress)) {
throw new IllegalArgumentException(
"The invalid IP address " + ipAddress + " is defined");
}
}
argList.add("--address");
argList.add(ipAddress);
File log = getLogFile();
if (log != null) {
argList.add("--log");
argList.add(log.getAbsolutePath());
}
Set<Map.Entry<String, String>> entries = serverArguments.entrySet();
for (Map.Entry<String, String> entry : entries) {
String argument = entry.getKey();
String value = entry.getValue();
if (StringUtils.isBlank(argument) || value == null) {
continue;
}
argList.add(argument);
if (!StringUtils.isBlank(value)) {
argList.add(value);
}
}
if (capabilities != null) {
argList.add("--default-capabilities");
argList.add(parseCapabilities());
}
return new ImmutableList.Builder<String>().addAll(argList).build();
}
示例7: matches
import org.apache.commons.validator.routines.InetAddressValidator; //导入方法依赖的package包/类
@Override
public boolean matches(String value) {
InetAddressValidator validator = InetAddressValidator.getInstance();
return validator.isValid(value);
}