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

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

Introduction

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

Prototype

String[] EMPTY_STRING_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Click Source Link

Document

An empty immutable String array.

Usage

From source file:com.cyclopsgroup.waterview.core.ModuleManager.java

/**
 * Remove package name/*from  www  .jav a 2s .c o m*/
 *
 * @param packageName Package name
 */
public void removeModulePackage(String packageName) {
    if (modulePackages.contains(packageName)) {
        modulePackages.remove(packageName);
        modulePackageNames = (String[]) modulePackages.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
    }
}

From source file:edu.cornell.med.icb.util.TestICBStringUtils.java

public void testSplitEmpty() {
    checkStringArray("testSplitEmpty", ArrayUtils.EMPTY_STRING_ARRAY, ICBStringUtils.split("", ':', ' '));
}

From source file:com.exoplatform.social.activity.storage.cache.CachedActivityStorage.java

private String[] processCommenters(String[] commenters, String commenter, List<String> addedOrRemovedIds,
        boolean isAdded) {
    if (commenter == null || commenter.length() == 0) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }/*  w  w  w  .j a  va 2 s .  c  o  m*/

    String newCommenter = commenter + MENTION_CHAR;
    commenters = isAdded ? add(commenters, newCommenter, addedOrRemovedIds)
            : remove(commenters, newCommenter, addedOrRemovedIds);

    return commenters;
}

From source file:io.fabric8.elasticsearch.plugin.OpenshiftAPIServiceTest.java

@Test
public void testLocalSubjectAccessReviewForNonResourceURL() throws IOException {
    OkHttpClient okClient = mock(OkHttpClient.class);
    DefaultOpenShiftClient client = mock(DefaultOpenShiftClient.class);
    OpenShiftClientFactory factory = mock(OpenShiftClientFactory.class);
    Call call = mock(Call.class);
    when(factory.buildClient(anyString())).thenReturn(client);
    when(client.getHttpClient()).thenReturn(okClient);
    when(client.getMasterUrl()).thenReturn(new URL("https://localhost:8443/"));

    Response response = new Response.Builder()
            .request(new Request.Builder().url("https://localhost:8443").build()).code(201)
            .protocol(Protocol.HTTP_1_1).message("")
            .body(ResponseBody.create(MediaType.parse("application/json;utf-8"), "{\"allowed\":true}")).build();

    RequestAnswer answer = new RequestAnswer(call);
    when(okClient.newCall(any(Request.class))).thenAnswer(answer);
    when(call.execute()).thenReturn(response);

    service = new OpenshiftAPIService(factory);

    assertTrue(service.localSubjectAccessReview("sometoken", "openshift-logging", "get", "/metrics", null,
            ArrayUtils.EMPTY_STRING_ARRAY));
    Buffer buffer = new Buffer();
    answer.getRequest().body().writeTo(buffer);
    assertEquals("https://localhost:8443/apis/authorization.openshift.io/v1/subjectaccessreviews",
            answer.getRequest().url().toString());
    String exp = "{\"kind\":\"SubjectAccessReview\","
            + "\"apiVersion\":\"authorization.openshift.io/v1\",\"verb\":\"get\",\"scopes\":[],"
            + "\"isNonResourceURL\":true,\"path\":\"/metrics\"}";
    assertEquals(exp, new String(buffer.readByteArray()));
}

From source file:com.jcwhatever.nucleus.internal.managed.commands.Arguments.java

/**
 * Constructor. Parses the provided arguments.
 *
 * @param command  The commands info annotation container.
 * @param args     The command arguments.
 *
 * @throws InvalidArgumentException    If a value provided is not valid.
 * @throws DuplicateArgumentException  If a parameter is defined in the arguments more than once.
 * @throws InvalidParameterException   If a parameter int the arguments is not found for the command.
 * @throws TooManyArgsException        If the provided arguments are more than is expected.
 *///  ww w . ja v  a  2s. c  o m
public Arguments(IRegisteredCommand command, @Nullable String[] args) throws CommandException {

    PreCon.notNull(command);

    _plugin = command.getPlugin();
    _command = command;
    _msg = Nucleus.getMessengerFactory().get(_plugin);
    _paramDescriptions = command.getInfo().getParamDescriptions();

    // substitute empty string to remove the need for null checks while parsing
    if (args == null)
        args = ArrayUtils.EMPTY_STRING_ARRAY;

    _rawArguments = args;

    // parse arguments
    _parseResults = new ArgumentParser().parse(command, args);
}

From source file:com.adobe.cq.wcm.core.components.models.impl.v1.PageImpl.java

private void addPolicyClientLibs(List<String> categories) {
    if (currentStyle != null) {
        Collections.addAll(categories, currentStyle.get(PN_CLIENTLIBS, ArrayUtils.EMPTY_STRING_ARRAY));
    }//from w  ww.  j ava2  s .co  m
}

From source file:gov.nih.nci.caarray.web.fileupload.MonitoredMultiPartRequest.java

/**
 * {@inheritDoc}/*  w w w .  java2s .c om*/
 */
public String[] getContentType(String fieldName) {
    return transformFileItemsForField(fieldName, ArrayUtils.EMPTY_STRING_ARRAY, new Transformer() {
        public Object transform(Object o) {
            return ((FileItem) o).getContentType();
        }
    });
}

From source file:gov.nih.nci.caarray.web.fileupload.MonitoredMultiPartRequest.java

/**
 * {@inheritDoc}/*w  w  w.  j a v a2 s .  c  o m*/
 */
public String[] getFileNames(String fieldName) {
    return transformFileItemsForField(fieldName, ArrayUtils.EMPTY_STRING_ARRAY, new Transformer() {
        public Object transform(Object o) {
            return getCanonicalName(((DiskFileItem) o).getName());
        }
    });
}

From source file:gov.nih.nci.caarray.web.fileupload.MonitoredMultiPartRequest.java

/**
 * {@inheritDoc}/*from   www .  j  ava 2  s .co  m*/
 */
public String[] getFilesystemName(String fieldName) {
    return transformFileItemsForField(fieldName, ArrayUtils.EMPTY_STRING_ARRAY, new Transformer() {
        public Object transform(Object o) {
            return ((DiskFileItem) o).getStoreLocation().getName();
        }
    });
}

From source file:ch.elexis.data.Query.java

/**
 * This method allows to set a custom sql query string; E.g. The original Query does not support
 * the usage of INNER JOINS, to use them nevertheless we need to provide a direct method to set
 * query strings/*from w  w  w. j  a v a  2  s .  com*/
 * 
 * @param cl
 *            the persistent object to set the query for
 * @param string
 *            the SQL query string
 * @author Marco Descher
 */
public Query(Class<? extends PersistentObject> cl, final String string) {
    try {
        template = CoreHub.poFactory.createTemplate(cl);
        load = cl.getMethod("load", new Class[] { String.class });
        sql = new StringBuilder(500);
        sql.append(string);
        ordering = null;
        fetchVals = ArrayUtils.EMPTY_STRING_ARRAY;
        clearEntityCache = false;
    } catch (Exception ex) {
        ElexisStatus status = new ElexisStatus(ElexisStatus.ERROR, CoreHub.PLUGIN_ID, ElexisStatus.CODE_NONE,
                "Query: Konnte Methode load auf " + cl.getName() + " nicht auflsen", ex,
                ElexisStatus.LOG_ERRORS);
        throw new PersistenceException(status);
    }
}