Example usage for org.apache.commons.lang3 Validate validIndex

List of usage examples for org.apache.commons.lang3 Validate validIndex

Introduction

In this page you can find the example usage for org.apache.commons.lang3 Validate validIndex.

Prototype

public static <T extends CharSequence> T validIndex(final T chars, final int index) 

Source Link

Document

Validates that the index is within the bounds of the argument character sequence; otherwise throwing an exception.

Validate.validIndex(myStr, 2);

If the character sequence is null , then the message of the exception is "The validated object is null".

If the index is invalid, then the message of the exception is "The validated character sequence index is invalid: " followed by the index.

Usage

From source file:com.msg.wmTestHelper.file.NameExtractor.java

public static ProcessFile extractProcessFile(File processFile) {
    ProcessFile result = new ProcessFile();

    String[] varNameParts = processFile.getName().split("[.]");

    Validate.validIndex(varNameParts, 2);

    if (isFiltered(varNameParts[2])) {
        return null;
    }/*from  ww w . j a va  2  s. co  m*/

    result.fileReference(processFile).version(getVersion(varNameParts)).name(getName(varNameParts));

    return result;
}