IPPortCheckerFactory.java
package com.ziesemer.utils.web.addressFilter.conditions;
/**
* @author Mark A. Ziesemer
* <a href="http://www.ziesemer.com."><www.ziesemer.com></a>
*/
public abstract class IPPortCheckerFactory{
public static IPortChecker createChecker(final String port) throws Exception{
final int rangeSplit = port.indexOf('-');
if(rangeSplit >= 0){
final int begin = Integer.parseInt(port.substring(0, rangeSplit));
final int end = Integer.parseInt(port.substring(rangeSplit + 1));
return new IPPortCheckerRange(begin, end);
}
final int portNum = Integer.parseInt(port);
return new IPPortCheckerExact(portNum);
}
}