List of usage examples for org.apache.commons.lang Validate notEmpty
public static void notEmpty(String string, String message)
Validate an argument, throwing IllegalArgumentException
if the argument String is empty (null
or zero length).
Validate.notEmpty(myString, "The string must not be empty");
From source file:ch.algotrader.dao.PositionDaoImpl.java
@Override public List<Position> findByStrategy(String strategyName) { Validate.notEmpty(strategyName, "Strategy name is empty"); return findCaching("Position.findByStrategy", QueryType.BY_NAME, new NamedParam("strategyName", strategyName)); }
From source file:ch.algotrader.dao.security.StockDaoImpl.java
@Override public List<Stock> findByIndustry(String code) { Validate.notEmpty(code, "Code is empty"); return findCaching("Stock.findByIndustry", QueryType.BY_NAME, new NamedParam("code", code)); }
From source file:edu.snu.leader.discrete.simulator.GautraisDecisionCalculator.java
@Override public void initialize(SimulationState simState) { _simState = simState;/*from w w w.j av a 2 s . com*/ String tauO = _simState.getProperties().getProperty("tau-o"); Validate.notEmpty(tauO, "tau-o may not be empty"); _tauO = Double.parseDouble(tauO); String alphaF = _simState.getProperties().getProperty("alpha-f"); Validate.notEmpty(alphaF, "alpha-f may not be empty"); _alphaF = Double.parseDouble(alphaF); String gammaC = _simState.getProperties().getProperty("gamma-c"); Validate.notEmpty(gammaC, "gamma-c may not be empty"); _gammaC = Double.parseDouble(gammaC); String epsilonC = _simState.getProperties().getProperty("epsilon-c"); Validate.notEmpty(epsilonC, "epsilon-c may not be empty"); _epsilonC = Double.parseDouble(epsilonC); String alphaC = _simState.getProperties().getProperty("alpha-c"); Validate.notEmpty(alphaC, "alpha-c may not be empty"); _alphaC = Double.parseDouble(alphaC); String betaF = _simState.getProperties().getProperty("beta-f"); Validate.notEmpty(betaF, "beta-f may not be empty"); _betaF = Double.parseDouble(betaF); String preCalcProbs = _simState.getProperties().getProperty("pre-calculate-probabilities"); Validate.notEmpty(preCalcProbs, "pre-calculate-probabilities may not be empty"); _preCalcProbs = Boolean.parseBoolean(preCalcProbs); String stringAgentCount = _simState.getProperties().getProperty("individual-count"); Validate.notEmpty(stringAgentCount, "individual-count may not be empty"); int agentCount = Integer.parseInt(stringAgentCount); // add gautrais info to root directory path _simState.setRootDirectory(Reporter.ROOT_DIRECTORY + "GautraisValues"); if (_preCalcProbs) { _followProbabilities = new double[agentCount]; _cancelProbabilities = new double[agentCount]; for (int r = 1; r < agentCount; r++) { _followProbabilities[r] = 1 / (_alphaF + ((_betaF * (agentCount - r)) / r)); _cancelProbabilities[r] = _alphaC / (1 + (Math.pow(r / _gammaC, _epsilonC))); } } }
From source file:ch.algotrader.dao.SubscriptionDaoImpl.java
@Override public List<Subscription> findByStrategy(String strategyName) { Validate.notEmpty(strategyName, "Strategy name is empty"); return findCaching("Subscription.findByStrategy", QueryType.BY_NAME, new NamedParam("strategyName", strategyName)); }
From source file:ch.algotrader.dao.security.CombinationDaoImpl.java
@Override public List<Combination> findSubscribedByStrategyAndUnderlying(String strategyName, long underlyingId) { Validate.notEmpty(strategyName, "Strategy name is empty"); return findCaching("Combination.findSubscribedByStrategyAndUnderlying", QueryType.BY_NAME, new NamedParam("strategyName", strategyName), new NamedParam("underlyingId", underlyingId)); }
From source file:net.ripe.rpki.commons.validation.ValidationLocation.java
public ValidationLocation(String name) { Validate.notEmpty(name, "name is required"); this.name = name; }
From source file:ch.algotrader.dao.AccountDaoImpl.java
@Override public Account findByExtAccount(final String extAccount) { Validate.notEmpty(extAccount, "External account is empty"); return findUniqueCaching("Account.findByExtAccount", QueryType.BY_NAME, new NamedParam("extAccount", extAccount)); }
From source file:ch.algotrader.dao.trade.OrderDaoImpl.java
@Override public BigDecimal findLastIntOrderIdByServiceType(String orderServiceType) { Validate.notEmpty(orderServiceType, "Order service type is empty"); return (BigDecimal) findUniqueObject(null, "Order.findLastIntOrderIdByServiceType", QueryType.BY_NAME, new NamedParam("orderServiceType", orderServiceType)); }
From source file:net.jadler.stubbing.StubRule.java
/** * @param predicates list of predicates. Cannot be null, however can be empty (which means this rule would * be matched by every request)//from w w w .j a v a 2 s .c o m * @param stubResponses list of stub response definitions. Must contain at least one stub response. */ public StubRule(final Collection<Matcher<? super Request>> predicates, final List<StubResponse> stubResponses) { Validate.notNull(predicates, "predicates cannot be null, use an empty list instead"); this.predicates = new ArrayList<Matcher<? super Request>>(predicates); Validate.notEmpty(stubResponses, "at least one stub response must be defined"); this.stubResponses = new ArrayList<StubResponse>(stubResponses); }
From source file:ch.algotrader.dao.security.SecurityDaoImpl.java
@Override public List<Security> findByIds(Collection<Long> ids) { Validate.notEmpty(ids, "Ids are empty"); return this.find("Security.findByIds", QueryType.BY_NAME, new NamedParam("ids", ids)); }