Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.api.cassandra;
 
import base.Query;
import static base.jee.api.cassandra.util.IpLocation.ipLocation;
import static base.jee.Constants.MAX_IP_ADDRESS_LENGTH;
public class GetLocationByIP extends Query<Location> {
	private CassandraAPI api;
	private String ip;
	public GetLocationByIP() {
	}
	public GetLocationByIP(CassandraAPI apiString ipthrows PermissionException {
		if(api == null) {
			throw new IllegalArgumentException("Invalid parameter: api");
		}
		if(ip == null || ip.length() > ) {
			throw new IllegalArgumentException("Invalid IP address.");
		}
		this. = api;
		this. = ip;
	}
	public Query<LocationnewWithParameters(Map<StringObjectparametersthrows PermissionException {
		return new GetLocationByIP(
				(CassandraAPI)parameters.get("api"),
				(String)parameters.get("ip"));
	}
	public List<Locationexecute() throws IOException {
		List<Locationresults = new LinkedList<>();
		Location l = ipLocation(s);
		if(l != null) {
			results.add(l);
		}
		return results;
	}
		return "{" +
				"\"ip\":\"" +  + "\"" +
				"}";
	}
New to GrepCode? Check out our FAQ X