Example usage for org.apache.wicket.util.lang Checks withinRangeShort

List of usage examples for org.apache.wicket.util.lang Checks withinRangeShort

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Checks withinRangeShort.

Prototype

public static <T extends Comparable<? super T>> void withinRangeShort(final T min, final T max, final T value,
        final String name) 

Source Link

Document

Checks if argument is within a range

Usage

From source file:com.github.marting.wicket.datastore.memcached.MemcachedDataStore.java

License:Apache License

/**
 * Creates MemcachedClient with the provided hostname and port
 * in the settings//  w w w . j av a 2 s .  com
 *
 * @param settings  The configuration for the client
 * @return A MemcachedClient
 */
private static MemcachedClient createClient(IMemcachedSettings settings) {
    Args.notNull(settings, "settings");

    String host = settings.getHost();
    Checks.notEmptyShort(host, "host");

    int port = settings.getPort();
    Checks.withinRangeShort(1, 65535, port, "port");

    try {
        MemcachedClient memcachedClient = new MemcachedClient(new InetSocketAddress(host, port));
        return memcachedClient;
    } catch (IOException iox) {
        throw new RuntimeException(iox);
    }
}

From source file:org.wicketstuff.datastores.memcached.GuavaMemcachedDataStore.java

License:Apache License

/**
 * Creates MemcachedClient with the provided hostname and port
 * in the settings// w ww . ja  v a2  s.c  o m
 *
 * @param settings  The configuration for the client
 * @return A MemcachedClient
 * @throws java.io.IOException when cannot connect to any of the provided Memcached servers
 */
public static MemcachedClient createClient(IMemcachedSettings settings) throws IOException {
    Args.notNull(settings, "settings");

    int port = settings.getPort();

    Checks.withinRangeShort(10000, 65535, port, "port");

    List<String> hostnames = settings.getServerList();
    int memcachedPort = settings.getPort();
    InetSocketAddress[] addresses = new InetSocketAddress[hostnames.size()];
    for (int i = 0; i < hostnames.size(); i++) {
        String hostname = hostnames.get(i);
        addresses[i] = new InetSocketAddress(hostname, memcachedPort);
    }

    return new MemcachedClient(addresses);
}

From source file:org.wicketstuff.gmap.api.GCircle.java

License:Apache License

public GCircle(GLatLng center, double radius, String strokeColor, int strokeWeight, float strokeOpacity,
        String fillColor, float fillOpacity) {
    this.center = Args.notNull(center, "center");

    Checks.withinRangeShort(1d, Double.MAX_VALUE, radius, "radius");
    this.radius = radius;

    this.strokeColor = strokeColor;
    this.strokeWeight = strokeWeight;
    this.strokeOpacity = strokeOpacity;
    this.fillColor = fillColor;
    this.fillOpacity = fillOpacity;
}

From source file:org.wicketstuff.gmap.api.GCircle.java

License:Apache License

public GCircle setZIndex(Integer zIndex) {
    if (zIndex != null) {
        Checks.withinRangeShort(0, Integer.MAX_VALUE, zIndex, "zIndex");
    }//  w w  w.  j av  a  2  s  .  c  om
    this.zIndex = zIndex;
    return this;
}

From source file:org.wicketstuff.gmap.api.GRectangle.java

License:Apache License

public GRectangle setZIndex(Integer zIndex) {
    if (zIndex != null) {
        Checks.withinRangeShort(0, Integer.MAX_VALUE, zIndex, "zIndex");
    }//from ww  w  .ja  va  2  s  .  c o m
    this.zIndex = zIndex;
    return this;
}