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:fr.ribesg.bukkit.api.chat.Hover.java

/**
 * Builds a new Hover of type {@link Type#SHOW_TEXT}.
 *
 * @param lines the text//w ww  .j  ava2  s .co  m
 *
 * @return a new Hover of type SHOW_TEXT
 */
public static Hover of(final String... lines) {
    Validate.notEmpty(lines, "lines can't be empty");
    Validate.noNullElements(lines, "lines can't contain null elements");
    // TODO Support \n in Strings here if wanted
    return new Hover(Type.SHOW_TEXT, lines.clone());
}

From source file:com.training.utils.EmbeddedActiveMQBroker.java

public EmbeddedActiveMQBroker(String brokerId) {
    Validate.notEmpty(brokerId, "brokerId is empty");
    this.brokerId = brokerId;
    tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable();

    brokerService = new BrokerService();
    brokerService.setBrokerId(brokerId);
    brokerService.setPersistent(false);/*from   ww  w  . jav  a  2  s . com*/
    brokerService.setUseJmx(false);
    try {
        brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter());
        brokerService.addConnector(tcpConnectorUri);
    } catch (Exception e) {
        throw new RuntimeException("Problem creating brokerService", e);
    }
}

From source file:com.marc.lastweek.web.util.behaviours.JavaScriptAlertConfirmBehaviour.java

/**
 * Class constructor.//from www  .ja v a2 s  .c om
 * 
 * @param key key which contains the message to show in the confirm window.
 * @param parameters value of parameters the message has (if it has any).
 */
public JavaScriptAlertConfirmBehaviour(final String key, final Object... parameters) {
    super(EVENT_NAME, true, new Model(key));
    Validate.notEmpty(key, "Key cannot be null");
    Validate.notNull(parameters, "Parameters cannot be null");
    this.parameters = ArrayUtils.clone(parameters);
}

From source file:io.cloudslang.orchestrator.entities.SplitMessage.java

public SplitMessage(String splitId, Execution parent, List<Execution> children) {
    Validate.notNull(splitId, "splitId cannot be null");
    Validate.notNull(parent, "parent cannot be null");
    Validate.notNull(children, "children cannot be null");
    Validate.notEmpty(children, "cannot create a split message without any children");

    this.splitId = splitId;
    this.parent = parent;
    this.children = new ArrayList<>(children);
}

From source file:ch.algotrader.wiring.adapter.IBSessionReconnector.java

public IBSessionReconnector(final String name, final IBSession session) {

    Validate.notEmpty(name, "Session name is null");
    Validate.notNull(session, "IBSession is null");
    this.name = name;
    this.session = session;
    this.executorService = Executors
            .newSingleThreadExecutor(new BasicThreadFactory("IB-reconnect-thread", true));
}

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

public RSAAMInstanceInfo(String siteID, String agentName, byte[] sdconfRec, byte[] sdoptsRec) {
    Validate.notEmpty(siteID, "siteID");
    Validate.notEmpty(agentName, "agentName");
    Validate.notNull(sdconfRec, "sdconfRec");

    this._siteID = siteID;
    this._agentName = agentName;
    this._sdconfRec = sdconfRec;
    this._sdoptsRec = sdoptsRec;
}

From source file:eu.codesketch.adam.docker.event.EventsResultCallbackDefault.java

public EventsResultCallbackDefault(Set<SwarmEventListener> listeners) {
    Validate.notEmpty(listeners, "listeners colelction must be provided and must not be empty");
    this.listeners = listeners;
}

From source file:io.cloudslang.lang.entities.SystemProperty.java

private SystemProperty(String namespace, String key, Value value, String description) {
    Validate.notNull(namespace, "System property namespace cannot be null");
    Validate.notEmpty(key, "System property key cannot be empty");

    String fullyQualifiedName;//from w w w. ja  v a2 s.  co m
    if (StringUtils.isNotEmpty(namespace)) {
        fullyQualifiedName = namespace + ScoreLangConstants.NAMESPACE_DELIMITER + key;
    } else {
        fullyQualifiedName = key;
    }

    if (value == null) {
        value = ValueFactory.create(null);
    }

    this.namespace = namespace;
    this.fullyQualifiedName = fullyQualifiedName;
    this.value = value;
    this.description = description;
}

From source file:com.vmware.identity.interop.ldap.SaslInputStructNative.java

public SaslInputStructNative(String userName, String pwd) {
    Validate.notEmpty(userName, "userName");
    Validate.notEmpty(pwd, "pwd");

    this.nativeMemories = new NativeMemory[2];

    // Set the native memory for username.
    String normalizedUserName = normalizeUserName(userName);
    byte[] bytes = Native.toByteArray(normalizedUserName, "UTF-8");
    nativeMemories[0] = new NativeMemory(bytes.length);
    nativeMemories[0].write(0, bytes, 0, bytes.length);
    authName = nativeMemories[0];/*  w w  w .java 2s . c  om*/
    authNameLength = bytes.length - 1; // Not including the ending '\0'

    // Set the native memory for password.
    bytes = Native.toByteArray(pwd, "UTF-8");
    nativeMemories[1] = new NativeMemory(bytes.length);
    nativeMemories[1].write(0, bytes, 0, bytes.length);
    password = nativeMemories[1];
    passwordLength = bytes.length - 1; // Not including the ending '\0'

    write();
}

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

@Override
public Account findByName(final String name) {

    Validate.notEmpty(name, "Account name is empty");

    return findUniqueCaching("Account.findByName", QueryType.BY_NAME, new NamedParam("name", name));
}