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

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

Introduction

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

Prototype

public static void notEmpty(String string, String message) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument String is empty (null or zero length).

 Validate.notEmpty(myString, "The string must not be empty"); 

Usage

From source file:ch.algotrader.dao.strategy.PortfolioValueDaoImpl.java

@Override
public <V> List<V> findByStrategyAndMinDate(String strategyName, Date minDate,
        EntityConverter<PortfolioValue, V> converter) {

    Validate.notEmpty(strategyName, "Strategy name is empty");
    Validate.notNull(minDate, "minDate is null");
    Validate.notNull(converter, "Converter is null");

    return find(converter, "PortfolioValue.findByStrategyAndMinDate", QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName), new NamedParam("minDate", minDate));
}

From source file:com.fusesource.test.http.HttpServerInterceptor.java

public HttpServerInterceptor respondsTo(String contextPath, String handlerResource) {
    Validate.notEmpty(contextPath, "contextPath is empty");
    Validate.notNull(handlerResource, "handlerResource is null");
    pathHandlers.put(contextPath, new ResourceHttpHandler(testClass, handlerResource));
    return this;
}

From source file:edu.snu.leader.discrete.simulator.SueurConflictPersonalityDecisionCalculator.java

@Override
public void initialize(SimulationState simState) {
    _simState = simState;// www.j  a  va  2s .  c o m

    String alpha = _simState.getProperties().getProperty("alpha");
    Validate.notEmpty(alpha, "Alpha may not be empty");
    _alpha = Double.parseDouble(alpha);

    String alphaC = _simState.getProperties().getProperty("alpha-c");
    Validate.notEmpty(alphaC, "Alpha-c may not be empty");
    _alphaC = Double.parseDouble(alphaC);

    String beta = _simState.getProperties().getProperty("beta");
    Validate.notEmpty(beta, "Beta may not be empty");
    _beta = Double.parseDouble(beta);

    String betaC = _simState.getProperties().getProperty("beta-c");
    Validate.notEmpty(betaC, "Beta-c may not be empty");
    _betaC = Double.parseDouble(betaC);

    String q = _simState.getProperties().getProperty("q");
    Validate.notEmpty(q, "q may not be empty");
    _q = Double.parseDouble(q);

    String S = _simState.getProperties().getProperty("S");
    Validate.notEmpty(S, "S may not be empty");
    _S = Integer.parseInt(S);

    String cancellationThreshold = _simState.getProperties().getProperty("cancellation-threshold");
    Validate.notEmpty(cancellationThreshold, "Use cancellation threshold may not be empty");

    // add sueur info to root directory path
    _simState.setRootDirectory(Reporter.ROOT_DIRECTORY + "q=" + _q + "_" + "S=" + _S);

}

From source file:net.dmulloy2.ultimatearena.api.ArenaTypeHandler.java

public final ArenaType getArenaType(String name) {
    Validate.notEmpty(name, "Name cannot be empty!");

    for (ArenaType type : arenaTypes.values()) {
        if (type.getName().equalsIgnoreCase(name))
            return type;
    }//from w  ww. j  a v  a2s.  c o  m

    return null;
}

From source file:fr.Axeldu18.PterodactylAPI.Methods.POSTMethods.java

/**
 * @param email Mail of the new user./*  w  w  w . j  a v a  2 s.c  o m*/
 * @param username Username of the new user.
 * @param first_name First name of the new user.
 * @param last_name Last name of the new user.
 * @param password Password of the new user OPTIONAL. (Leave blank will be generated by the panel randomly)
 * @param root_admin Set the root admin role of the new user.
 * @return if success it return the ID of the new user.
 */
public String createNode(String email, String username, String first_name, String last_name, String password,
        boolean root_admin) {
    Validate.notEmpty(email, "The MAIL is required");
    Validate.notEmpty(username, "The USERNAME is required");
    Validate.notEmpty(first_name, "The FIRST_NAME is required");
    Validate.notEmpty(last_name, "The LAST_NAME is required");
    Validate.notNull(root_admin, "The ROOT_ADMIN Boolean is required");
    int admin = (root_admin) ? 1 : 0;
    return call(main.getMainURL() + Methods.USERS_CREATE_USER.getURL(),
            "email=" + email + "&username=" + username + "&name_first=" + first_name + "&name_last=" + last_name
                    + "&password=" + password + "&root_admin=" + admin);
}

From source file:ch.algotrader.dao.security.ComponentDaoImpl.java

@Override
public List<Component> findSubscribedByStrategyAndSecurityInclSecurity(String strategyName, long securityId) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    return findCaching("Component.findSubscribedByStrategyAndSecurityInclSecurity", QueryType.BY_NAME,
            new NamedParam("strategyName", strategyName), new NamedParam("securityId", securityId));
}

From source file:ch.algotrader.dao.TransactionDaoImpl.java

@Override
public List<Transaction> findDailyTransactionsByStrategy(String strategyName) {

    Validate.notEmpty(strategyName, "Strategy name is empty");

    LocalDate today = LocalDate.now();
    return find("Transaction.findDailyTransactionsByStrategy", QueryType.BY_NAME,
            new NamedParam("curdate", DateTimeLegacy.toLocalDate(today)),
            new NamedParam("strategyName", strategyName));
}

From source file:ch.algotrader.dao.security.StockDaoImpl.java

@Override
public List<Stock> findBySubIndustry(String code) {

    Validate.notEmpty(code, "Code is empty");

    return findCaching("Stock.findBySubIndustry", QueryType.BY_NAME, new NamedParam("code", code));
}

From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.twoasset.TwoAssetAnalyticOptionModel.java

/**
 * Note that currently the only greek that can be calculated is the fair price. If other greeks are requested a warning is given and
 * nothing is added to the result//from   ww w  .  j  a va  2 s  . c om
 * @param definition The option definition
 * @param data The type of the data
 * @param requiredGreeks The greeks that are to be calculated
 * @return A {@link GreekResultCollection} containing the results
 * @throws IllegalArgumentException If any of the arguments are null, or if the set of required greeks is empty
 */
@Override
public GreekResultCollection getGreeks(final T definition, final U data, final Set<Greek> requiredGreeks) {
    Validate.notNull(definition, "definition");
    Validate.notNull(data, "data");
    Validate.notNull(requiredGreeks, "required greeks");
    Validate.notEmpty(requiredGreeks, "required greeks");
    final Function1D<U, Double> pricingFunction = getPricingFunction(definition);
    final GreekResultCollection results = new GreekResultCollection();
    for (final Greek greek : requiredGreeks) {
        if (greek != Greek.FAIR_PRICE) {
            s_logger.warn("Can only calculate price for two-asset options, not calculating " + greek);
        } else {
            results.put(greek, pricingFunction.evaluate(data));
        }
    }
    return results;
}

From source file:com.mxhero.plugin.cloudstorage.onedrive.api.RedeemRequest.java

/**
 * Validate.//  w  w  w.j  a v a2  s  . c  o  m
 */
public void validate() {
    Validate.notEmpty(code, "code field must be provided");
    Validate.notEmpty(clientId, "clientId field must be provided");
    Validate.notEmpty(clientSecret, "clientSecret field must be provided");
    Validate.notEmpty(redirectUri, "redirectUri field must be provided");
}