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:edu.snu.leader.discrete.simulator.SueurConflictDecisionCalculator.java
@Override public void initialize(SimulationState simState) { _simState = simState;/* w w w . j a va 2 s.c o m*/ // get values from properties 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"); String defConflictValue = _simState.getProperties().getProperty("default-conflict-value"); Validate.notEmpty(defConflictValue, "default-conflict-value may not be empty"); _defaultConflictValue = Double.parseDouble(defConflictValue); _destinationSizeRadius = _simState.getDestinationRadius(); // add sueur info to root directory path _simState.setRootDirectory(Reporter.ROOT_DIRECTORY + "SueurValues"); }
From source file:com.dsh105.powermessage.action.ActionEvent.java
@Override public JsonWriter writeJson(JsonWriter writer) throws IOException { Validate.notEmpty(name, "Action name cannot be empty!"); Validate.notEmpty(data, "Action data cannot be empty!"); writer.name(actionType + "Event").beginObject().name("action").value(this.name).name("value") .value(this.data).endObject(); return writer; }
From source file:com.genericworkflownodes.knime.workflowexporter.ui.wizard.WorkflowExportWizard.java
/** * Constructor./*from w ww. ja v a2s . c o m*/ */ public WorkflowExportWizard(final WorkflowEditor workflowEditor, final Collection<KnimeWorkflowExporter> exporters) { Validate.notNull(workflowEditor, "workflowEditor is required and cannot be null"); Validate.notEmpty(exporters, "exporter is required and cannot be null or empty"); workflowExportPage = new WorkflowExportPage(exporters); setWindowTitle("Export a Workflow to other platforms"); setDefaultPageImageDescriptor(ImageRepository.getImageDescriptor(SharedImages.ExportBig)); setNeedsProgressMonitor(true); this.exporters = new ArrayList<KnimeWorkflowExporter>(exporters); this.workflowEditor = workflowEditor; }
From source file:ch.algotrader.dao.SubscriptionDaoImpl.java
@Override public List<Subscription> findByStrategyInclProps(String strategyName) { Validate.notEmpty(strategyName, "Strategy name is empty"); return find("Subscription.findByStrategyInclProps", QueryType.BY_NAME, new NamedParam("strategyName", strategyName)); }
From source file:com.edmunds.etm.runtime.api.ApplicationSeries.java
private ApplicationSeries(String name, SortedMap<ApplicationVersion, Application> applicationsByVersion) { Validate.notEmpty(name, "Application series name is empty"); this.name = name; this.applicationsByVersion = ImmutableSortedMap.copyOf(applicationsByVersion); }
From source file:edu.snu.leader.hidden.builder.BiDirectionalIndividualBuilder.java
/** * Initializes the builder/*from ww w. jav a2 s .com*/ * * @param simState The simulation's state * @see edu.snu.leader.hidden.builder.AbstractIndividualBuilder#initialize(edu.snu.leader.hidden.SimulationState) */ @Override public void initialize(SimulationState simState) { _LOG.trace("Entering initialize( simState )"); // Call the superclass implementation super.initialize(simState); // Get the properties Properties props = simState.getProps(); // Get the direction delta value String dirDeltaStr = props.getProperty(_DIR_DELTA_KEY); Validate.notEmpty(dirDeltaStr, "Direction delta (key=" + _DIR_DELTA_KEY + ") may not be empty"); _dirDelta = Float.parseFloat(dirDeltaStr); _LOG.info("Using _dirDelta=[" + _dirDelta + "]"); // Get the positive delta probability String posDeltaProbabilityStr = props.getProperty(_POS_DELTA_PROB_KEY); Validate.notEmpty(posDeltaProbabilityStr, "Positive delta percentage (key=" + _POS_DELTA_PROB_KEY + ") may not be empty"); _positiveDeltaProbability = Float.parseFloat(posDeltaProbabilityStr); _LOG.info("Using _dirDelta=[" + _positiveDeltaProbability + "]"); _LOG.trace("Leaving initialize( simState )"); }
From source file:edu.snu.leader.spatial.calculator.CompactSigmoidSueurDecisionProbabilityCalculator.java
/** * Initializes the calculator/*from w ww . j a va 2 s. com*/ * * @param simState The simulation's state * @see edu.snu.leader.spatial.DecisionProbabilityCalculator#initialize(edu.snu.leader.spatial.SimulationState) */ @Override public void initialize(SimulationState simState) { _LOG.trace("Entering initialize( simState )"); // Call superclass implementation super.initialize(simState); // Get the properties Properties props = simState.getProperties(); // Get the sigmoid slope value String sigmoidSlopeValueStr = props.getProperty(_SIGMOID_SLOPE_VALUE_KEY); Validate.notEmpty(sigmoidSlopeValueStr, "Sigmoid slope value (Key =" + _SIGMOID_SLOPE_VALUE_KEY + ") may not be empty "); _sigmoidSlopeValue = Float.parseFloat(sigmoidSlopeValueStr); _LOG.info("Using _sigmoidSlopeValue = [" + _sigmoidSlopeValue + "]"); _LOG.trace("Leaving initialize( simState )"); }
From source file:edu.snu.leader.hidden.builder.SpecificPersonalityIndividualBuilder.java
/** * Initializes the builder/* w w w . ja va 2 s. c om*/ * * @param simState The simulation's state * @see edu.snu.leader.hidden.builder.AbstractIndividualBuilder#initialize(edu.snu.leader.hidden.SimulationState) */ @Override public void initialize(SimulationState simState) { _LOG.trace("Entering initialize( simState )"); // Call the superclass implementation super.initialize(simState); // Get the properties Properties props = simState.getProps(); // Get the specific personality String specificPersonalityStr = props.getProperty(_SPECIFIC_PERSONALITY); Validate.notEmpty(specificPersonalityStr, "Specific personality value (key=" + _SPECIFIC_PERSONALITY + ") may not be empty"); _personality = Float.parseFloat(specificPersonalityStr); _LOG.info("Using _personality=[" + _personality + "]"); _LOG.trace("Leaving initialize( simState )"); }
From source file:it.gualtierotesta.gdocx.GP.java
/** * Add all strings in the array, each on a separate Run * * @param aText array of text strings/*w w w . ja va2 s. c o m*/ * @return same GP instance */ @Nonnull public GP text(@Nonnull final String... aText) { Validate.notEmpty(aText, "String array not valid"); final int length = aText.length; for (int i = 0; i < length; i++) { if (null != aText[i]) { final Text text = FACTORY.createText(); text.setValue(aText[i]); final R run = FACTORY.createR(); run.getContent().add(text); run.setRPr(getRPr()); getContent().add(run); if (i + 1 != length) { final R runBr = FACTORY.createR(); runBr.getContent().add(FACTORY.createBr()); getContent().add(runBr); } } } return this; }
From source file:ch.algotrader.service.fix.FixMarketDataServiceImpl.java
public FixMarketDataServiceImpl(final String feedType, final ExternalSessionStateHolder stateHolder, final FixAdapter fixAdapter, final RequestIdGenerator<Security> tickerIdGenerator, final Engine serverEngine) { Validate.notEmpty(feedType, "FeedType is null"); Validate.notNull(stateHolder, "FixSessionStateHolder is null"); Validate.notNull(fixAdapter, "FixAdapter is null"); Validate.notNull(tickerIdGenerator, "RequestIdGenerator is null"); Validate.notNull(serverEngine, "Engine is null"); this.feedType = feedType; this.stateHolder = stateHolder; this.fixAdapter = fixAdapter; this.tickerIdGenerator = tickerIdGenerator; this.serverEngine = serverEngine; }