Example usage for org.apache.commons.lang Validate notNull

List of usage examples for org.apache.commons.lang Validate notNull

Introduction

In this page you can find the example usage for org.apache.commons.lang Validate notNull.

Prototype

public static void notNull(Object object, String message) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument is null.

 Validate.notNull(myObject, "The object must not be null"); 

Usage

From source file:com.vmware.identity.rest.idm.server.mapper.ResourceServerMapper.java

public static Collection<ResourceServerDTO> getResourceServerDTOs(Collection<ResourceServer> resourceServers) {
    Validate.notNull(resourceServers, "resourceServers");
    Collection<ResourceServerDTO> resourceServerDTOs = new ArrayList<ResourceServerDTO>();
    for (ResourceServer resourceServer : resourceServers) {
        resourceServerDTOs.add(getResourceServerDTO(resourceServer));
    }//from   w  w  w  .jav  a 2 s  . c  o m
    return resourceServerDTOs;
}

From source file:com.stealthyone.mcb.mcml.MCMLHoverEventAchievement.java

MCMLHoverEventAchievement(String rawText) {
    Validate.notNull(rawText, "Raw text cannot be null.");
    if (rawText.length() == 6) {
        throw new IllegalArgumentException("Achievement hover event must have input.");
    }/*from  w  w  w . j  av a 2 s.c  o  m*/
    achievement = rawText.substring(5, rawText.length() - 1);
}

From source file:com.evolveum.midpoint.repo.sql.util.ScrollableResultsIterator.java

public ScrollableResultsIterator(ScrollableResults results) {
    Validate.notNull(results, "Scrollable results must not be null.");

    this.results = results;
}

From source file:com.opengamma.analytics.math.statistics.descriptive.SampleMomentCalculator.java

/**
 * @param x The array of data, not null or empty
 * @return The sample raw moment//from   www .jav  a2  s . co  m
 */
@Override
public Double evaluate(final double[] x) {
    Validate.notNull(x, "x was null");
    Validate.isTrue(x.length > 0, "x was empty");
    if (_n == 0) {
        return 1.;
    }
    double sum = 0;
    for (final Double d : x) {
        sum += Math.pow(d, _n);
    }
    return sum / (x.length - 1);
}

From source file:com.stealthyone.mcb.mcml.MCMLClickEventSuggestCommand.java

MCMLClickEventSuggestCommand(String rawText) {
    Validate.notNull(rawText, "Raw text cannot be null.");
    if (rawText.length() == 7) {
        throw new IllegalArgumentException("Suggest command click event must have input.");
    }//from www. jav  a2s  .c o m
    command = rawText.substring(6, rawText.length() - 1);
}

From source file:com.opengamma.analytics.math.statistics.descriptive.QuartileSkewnessCalculator.java

/**
 * @param x The array of data, not null. Must contain at least three points.
 * @return The quartile skewness./*  w w w  . ja  v a 2 s . co  m*/
 */
@Override
public Double evaluate(final double[] x) {
    Validate.notNull(x, "x");
    final int n = x.length;
    Validate.isTrue(n >= 3, "Need at least three points to calculate interquartile range");
    if (n == 3) {
        return (x[2] - 2 * x[1] + x[0]) / 2.;
    }
    final double[] copy = Arrays.copyOf(x, n);
    Arrays.sort(copy);
    double[] lower, upper;
    if (n % 2 == 0) {
        lower = Arrays.copyOfRange(copy, 0, n / 2);
        upper = Arrays.copyOfRange(copy, n / 2, n);
    } else {
        lower = Arrays.copyOfRange(copy, 0, n / 2 + 1);
        upper = Arrays.copyOfRange(copy, n / 2, n);
    }
    final double q1 = MEDIAN.evaluate(lower);
    final double q2 = MEDIAN.evaluate(x);
    final double q3 = MEDIAN.evaluate(upper);
    return (q1 - 2 * q2 + q3) / (q3 - q1);
}

From source file:com.opengamma.analytics.math.statistics.distribution.StudentTTwoTailedCriticalValueCalculator.java

@Override
public Double evaluate(final Double x) {
    Validate.notNull(x, "x");
    ArgumentChecker.notNegative(x, "x");
    return _calc.evaluate(0.5 + 0.5 * x);
}

From source file:net.jadler.stubbing.server.jetty.JadlerHandler.java

/**
 * @param requestManager request manager instance to retrieve stub responses
 *///from  w w  w.j a  va 2 s .  com
JadlerHandler(final RequestManager requestManager) {
    Validate.notNull(requestManager, "requestManager cannot be null");
    this.requestManager = requestManager;
}

From source file:com.evolveum.midpoint.repo.sql.data.common.any.RValueType.java

public static RValueType getTypeFromValueClass(Class<? extends PrismValue> clazz) {
    Validate.notNull(clazz, "Class must not be null.");
    for (RValueType value : RValueType.values()) {
        if (value.getValueClass().isAssignableFrom(clazz)) {
            return value;
        }//w  w  w. j a  v  a  2s  .  c  o m
    }

    throw new IllegalArgumentException("Unknown enum value type for '" + clazz.getName() + "'.");
}

From source file:com.evolveum.midpoint.repo.sql.query2.hqm.condition.PropertyCondition.java

public PropertyCondition(RootHibernateQuery rootHibernateQuery, String propertyPath) {
    super(rootHibernateQuery);
    Validate.notNull(propertyPath, "propertyPath");
    this.propertyPath = propertyPath;
}