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:com.opengamma.analytics.math.interpolation.data.InterpolatorNDDataBundle.java

private void validateData(final List<Pair<double[], Double>> data) {
    Validate.notEmpty(data, "no data");
    final Iterator<Pair<double[], Double>> iter = data.iterator();
    final int dim = iter.next().getFirst().length;
    Validate.isTrue(dim > 0, "no actual data");
    while (iter.hasNext()) {
        Validate.isTrue(iter.next().getFirst().length == dim, "different dimensions in data");
    }//from www.  j  a va2 s .c  om
}

From source file:com.bibisco.manager.RichTextEditorSettingsManager.java

public static void save(RichTextEditorSettings pRichTextEditorSettings) {

    mLog.debug("Start save()");

    Validate.notNull(pRichTextEditorSettings, "RichTextEditorSettings cannot be null");
    Validate.notEmpty(pRichTextEditorSettings.getFont(), "RichTextEditorSettings.font cannot be empty");
    Validate.notEmpty(pRichTextEditorSettings.getSize(), "RichTextEditorSettings.size cannot be empty");
    Validate.isTrue(/*w  ww .ja  va 2 s .c om*/
            pRichTextEditorSettings.getFont().equals("courier")
                    || pRichTextEditorSettings.getFont().equals("times")
                    || pRichTextEditorSettings.getFont().equals("arial"),
            "RichTextEditorSettings.size can be courier, times, arial");
    Validate.isTrue(
            pRichTextEditorSettings.getSize().equals("small")
                    || pRichTextEditorSettings.getSize().equals("medium")
                    || pRichTextEditorSettings.getSize().equals("big"),
            "RichTextEditorSettings.size can be small, medium, big");

    Map<String, String> lMapProperties = new HashMap<String, String>();
    lMapProperties.put("font", pRichTextEditorSettings.getFont());
    lMapProperties.put("font-size", pRichTextEditorSettings.getSize());
    lMapProperties.put("spellCheckEnabled", String.valueOf(pRichTextEditorSettings.isSpellCheckEnabled()));
    PropertiesManager.getInstance().updateProperties(lMapProperties);

    mLog.debug("End save()");
}

From source file:net.jadler.stubbing.StaticResponder.java

/**
 * Creates a {@link Responder} which returns stub responses from a predefined list.
 * @param stubResponses list of predefined stub responses (cannot be empty)
 *///  ww w  .  ja  v a 2s. c  o  m
StaticResponder(final List<StubResponse> stubResponses) {
    Validate.notEmpty(stubResponses, "stubResponses cannot be empty");
    this.stubResponses = stubResponses;
}

From source file:com.evolveum.midpoint.schema.xjc.schema.FieldBox.java

public FieldBox(String fieldName, T value) {
    Validate.notEmpty(fieldName, "Field name must not be null or empty.");
    Validate.notNull("QName must not be null.");

    this.fieldName = fieldName;
    this.value = value;
}

From source file:com.fusesource.examples.horo.rssReader.StarSignParser.java

public StarSign parse(@Header("title") String title) {
    Validate.notEmpty(title, "title is empty");

    StarSign starSign = null;//from  w ww. j ava 2 s .c  om
    StringTokenizer tokenizer = new StringTokenizer(title, " ");
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        starSign = StarSign.getInstance(token);
        if (starSign != null) {
            break;
        }
    }
    return starSign;
}

From source file:com.opengamma.analytics.financial.riskfactor.TaylorExpansionMultiplierCalculator.java

public static double getValue(final Map<UnderlyingType, Double> underlyingData, final Underlying underlying) {
    Validate.notNull(underlying, "underlying");
    Validate.notNull(underlyingData, "underlying data");
    Validate.notEmpty(underlyingData, "underlying data");
    Validate.noNullElements(underlyingData.keySet(), "underlying data keys");
    Validate.noNullElements(underlyingData.values(), "underlying data values");
    if (underlying instanceof NthOrderUnderlying) {
        final NthOrderUnderlying nthOrder = (NthOrderUnderlying) underlying;
        final int n = nthOrder.getOrder();
        if (n == 0) {
            return 1;
        }/*from   ww  w . j a  va  2 s .  c  o m*/
        final UnderlyingType type = nthOrder.getUnderlying();
        Validate.isTrue(underlyingData.containsKey(type));
        final double value = Math.pow(underlyingData.get(type), n);
        return value * getMultiplier(underlying);
    } else if (underlying instanceof MixedOrderUnderlying) {
        final MixedOrderUnderlying mixedOrder = (MixedOrderUnderlying) underlying;
        Double result = null;
        double multiplier;
        for (final NthOrderUnderlying underlyingOrder : mixedOrder.getUnderlyingOrders()) {
            if (result == null) {
                result = getValue(underlyingData, underlyingOrder);
            } else {
                multiplier = getValue(underlyingData, underlyingOrder);
                result = result * multiplier;
            }
        }
        if (result != null) {
            return result;
        }
    }
    throw new IllegalArgumentException(
            "Order was neither NthOrderUnderlying nor MixedOrderUnderlying: have " + underlying.getClass());
}

From source file:com.vmware.identity.idm.RSAAMResult.java

public RSAAMResult(String rsaSessionID) {
    Validate.notEmpty(rsaSessionID, "Null or Empty RSA sessionID");
    this.rsaSessionID = rsaSessionID;
    this.principalId = null;
}

From source file:com.palantir.atlasdb.schema.Namespace.java

public static Namespace create(String name, Pattern p) {
    Validate.notEmpty(name, "namespace name cannot be empty (see Namespace.EMPTY_NAMESPACE instead).");
    Validate.isTrue(!name.contains("."), "namespace cannot contain dots (atlas reserved).");
    Validate.isTrue(p.matcher(name).matches(), "'" + name + "' does not match namespace pattern '" + p + "'.");
    return new Namespace(name);
}

From source file:bigbluej.GetRecordingsCommand.java

public GetRecordingsCommand(String meetingID) {
    Validate.notEmpty(meetingID, "meetingID");
    this.meetingID = meetingID;
}

From source file:com.edmunds.etm.web.util.BooleanDecorator.java

public BooleanDecorator(String propertyName) {
    Validate.notEmpty(propertyName, "Property name is empty");
    this.propertyName = propertyName;
}