Example usage for org.apache.commons.lang ArrayUtils isEmpty

List of usage examples for org.apache.commons.lang ArrayUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils isEmpty.

Prototype

public static boolean isEmpty(boolean[] array) 

Source Link

Document

Checks if an array of primitive booleans is empty or null.

Usage

From source file:com.ning.metrics.collector.endpoint.setup.SetupJULBridge.java

@Override
public void contextInitialized(final ServletContextEvent event) {
    // we first remove the default handler(s)
    final Logger rootLogger = LogManager.getLogManager().getLogger("");
    final Handler[] handlers = rootLogger.getHandlers();

    if (!ArrayUtils.isEmpty(handlers)) {
        for (final Handler handler : handlers) {
            rootLogger.removeHandler(handler);
        }/*from w w w .  j  av a  2 s .com*/
    }
    // and then we let jul-to-sfl4j do its magic so that jersey messages go to sfl4j (and thus log4j)
    SLF4JBridgeHandler.install();

    log.info("Assimilated java.util Logging");
}

From source file:com.bfd.harpc.common.configure.ResourceUtils.java

/**
 * jar?<br />/*from   ww  w . jav  a  2s . c om*/
 * loadResources()??
 * <p>
 * 
 * @param locationPattern
 * <br/>
 *            0. ????{@link ResourceConstants}<br />
 *            1. fileclasspathclasspath*?<br />
 *            2. classpath?<br />
 *            3. classpath*??jar<br />
 *            4. file?<br />
 *            5. classpath 6.
 *            classpath*:log/log4j.xml;file:/home/ydhl/
 *            abc.sh;classpath:log/log4j.xml
 * @return URL
 * @throws IOException
 * @throws URISyntaxException
 */
public static URL loadResource(String locationPattern) throws IOException, URISyntaxException {
    URL[] urlArray = loadResources(locationPattern);

    return ArrayUtils.isEmpty(urlArray) ? null : urlArray[0];
}

From source file:com.qcadoo.view.api.exception.ExceptionInfo.java

public ExceptionInfo(final String messageHeader, final String messageExplanation,
        final String... messageExplanationArgs) {
    this.messageHeader = messageHeader;
    this.messageExplanation = messageExplanation;
    if (ArrayUtils.isEmpty(messageExplanationArgs)) {
        this.messageExplanationArgs = ArrayUtils.EMPTY_STRING_ARRAY;
    } else {/*from  www  .  j ava2s. c o m*/
        this.messageExplanationArgs = messageExplanationArgs;
    }
}

From source file:de.codesourcery.eve.apiclient.parsers.ResolveNamesParser.java

public ResolveNamesParser(String[] ids, Set<EntityType> idTypes, ISystemClock clock) {

    super(clock);

    if (ArrayUtils.isEmpty(ids)) {
        throw new IllegalArgumentException("ids cannot be NULL / empty ");
    }/*  ww w.  java  2s  .  co m*/

    if (idTypes == null || idTypes.isEmpty()) {
        throw new IllegalArgumentException("entity types cannot be NULL / empty ");
    }

    this.types = idTypes;

    for (String id : ids) {
        if (id == null) {
            throw new IllegalArgumentException("NULL id ?");
        }
        result.put(id, null);
    }
}

From source file:com.qcadoo.model.api.validators.ErrorMessage.java

/**
 * Create new validation error message.//from   w  ww . j a  v  a2 s .co  m
 * 
 * @param message
 *            message
 * @param vars
 *            message's vars
 */
public ErrorMessage(final String message, final String... vars) {
    this.message = message;
    if (ArrayUtils.isEmpty(vars)) {
        this.vars = ArrayUtils.EMPTY_STRING_ARRAY;
    } else {
        this.vars = vars;
    }
}

From source file:com.qcadoo.model.internal.api.ValueAndError.java

private ValueAndError(final Object value, final String message, final String... args) {
    this.value = value;
    this.message = message;
    if (ArrayUtils.isEmpty(args)) {
        this.args = ArrayUtils.EMPTY_STRING_ARRAY;
    } else {/*w ww  .j  a  v a 2 s .  c om*/
        this.args = args;
    }
}

From source file:com.sunyue.util.calculator.impl.parser.AbstractExpressionParser.java

protected AbstractExpressionParser(Operator[] operators) {
    if (ArrayUtils.isEmpty(operators)) {
        throw new CalculationException("At least one operator is necessary.");
    }/*from  w  w w .  ja  va  2s .c  om*/
    for (int i = 0; i < operators.length; i++) {
        if (operators[i] != null) {
            operatorMap.put(operators[i].getSymbol(), operators[i]);
        }
    }
}

From source file:de.codesourcery.eve.skills.production.entity.EveOnlineJobTemplate.java

public final boolean hasType(Type... types) {

    if (ArrayUtils.isEmpty(types)) {
        throw new IllegalArgumentException("types cannot be NULL/empty");
    }//from   w w  w .j av a  2  s. c om
    for (Type expected : types) {
        if (getType() == expected) {
            return true;
        }
    }
    return false;
}

From source file:fr.exanpe.t5.lib.services.impl.AuthorizeBusinessServiceImpl.java

public boolean applyAll(String[] all) {
    if (ArrayUtils.isEmpty(all)) {
        return true;
    }/*from  w w w  .j  a  v  a2 s .c o m*/

    String[] roles = all;
    for (String r : roles) {
        if (r != null && !request.getHTTPServletRequest().isUserInRole(r.trim())) {
            return false;
        }
    }

    return true;
}

From source file:eionet.cr.web.util.tabs.TabElement.java

/**
 * Class constructor./*w  ww  . j av a  2  s. c o m*/
 *
 * @param title
 * @param href
 * @param selectedTitle
 */
public TabElement(String title, String href, String... selectedTitle) {
    this.title = title;
    this.href = href;
    selected = ArrayUtils.isEmpty(selectedTitle) ? false : ArrayUtils.contains(selectedTitle, title);
}