Example usage for org.apache.commons.lang3 StringUtils stripToNull

List of usage examples for org.apache.commons.lang3 StringUtils stripToNull

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils stripToNull.

Prototype

public static String stripToNull(String str) 

Source Link

Document

Strips whitespace from the start and end of a String returning null if the String is empty ("") after the strip.

This is similar to #trimToNull(String) but removes whitespace.

Usage

From source file:org.apache.samza.system.kafka.descriptors.KafkaInputDescriptor.java

/**
 * This setting determines what happens if a consumer attempts to read an offset for this topic that is outside of
 * the current valid range. This could happen if the topic does not exist, or if a checkpoint is older than the
 * maximum message history retained by the brokers. This property is not to be confused with
 * {@link InputDescriptor#withOffsetDefault}, which determines what happens if there is no checkpoint.
 * <p>/*from  www. j  ava2 s  .  c  o  m*/
 * The following are valid values for auto.offset.reset:
 * <ul>
 *   <li>smallest: Start consuming at the smallest (oldest) offset available on the broker
 *   (process as much message history as available).
 *   <li>largest: Start consuming at the largest (newest) offset available on the broker
 *   (skip any messages published while the job was not running).
 *   <li>anything else: Throw an exception and refuse to start up the job.
 * </ul>
 * <p>
 * Note: This property may be set at a system level using {@link KafkaSystemDescriptor#withConsumerAutoOffsetReset}
 *
 * @param consumerAutoOffsetReset consumer auto offset reset policy for the input
 * @return this input descriptor
 */
public KafkaInputDescriptor<StreamMessageType> withConsumerAutoOffsetReset(String consumerAutoOffsetReset) {
    this.consumerAutoOffsetResetOptional = Optional
            .ofNullable(StringUtils.stripToNull(consumerAutoOffsetReset));
    return this;
}

From source file:org.apache.samza.system.kafka.descriptors.KafkaSystemDescriptor.java

/**
 * This setting determines what happens if a consumer attempts to read an offset that is outside of the current
 * valid range. This could happen if the topic does not exist, or if a checkpoint is older than the maximum message
 * history retained by the brokers. This property is not to be confused with {@link InputDescriptor#withOffsetDefault},
 * which determines what happens if there is no checkpoint.
 * <p>//from www .j a va 2  s .  com
 * The following are valid values for auto.offset.reset:
 * <ul>
 *   <li>smallest: Start consuming at the smallest (oldest) offset available on the broker
 *   (process as much message history as available).
 *   <li>largest: Start consuming at the largest (newest) offset available on the broker
 *   (skip any messages published while the job was not running).
 *   <li>anything else: Throw an exception and refuse to start up the job.
 * </ul>
 * <p>
 * Note: This property may be set at a topic level using {@link KafkaInputDescriptor#withConsumerAutoOffsetReset}
 *
 * @param consumerAutoOffsetReset consumer auto offset reset policy for the system
 * @return this system descriptor
 */
public KafkaSystemDescriptor withConsumerAutoOffsetReset(String consumerAutoOffsetReset) {
    this.consumerAutoOffsetResetOptional = Optional
            .ofNullable(StringUtils.stripToNull(consumerAutoOffsetReset));
    return this;
}

From source file:org.apache.samza.system.kafka.KafkaInputDescriptor.java

/**
 * This setting determines what happens if a consumer attempts to read an offset for this topic that is outside of
 * the current valid range. This could happen if the topic does not exist, or if a checkpoint is older than the
 * maximum message history retained by the brokers. This property is not to be confused with
 * {@link InputDescriptor#withOffsetDefault}, which determines what happens if there is no checkpoint.
 * <p>//from   w ww  .  ja  v a  2s .c  om
 * The following are valid values for auto.offset.reset:
 * <ul>
 *   <li>smallest: Start consuming at the smallest (oldest) offset available on the broker
 *   (process as much message history as available).
 *   <li>largest: Start consuming at the largest (newest) offset available on the broker
 *   (skip any messages published while the job was not running).
 *   <li>anything else: Throw an exception and refuse to start up the job.
 * </ul>
 * <p>
 * Note: This property may be set at a system level using {@link KafkaSystemDescriptor#withConsumerAutoOffsetReset}
 *
 * @param consumerAutoOffsetReset consumer auto offset reset policy for the input
 * @return this input descriptor
 */
public KafkaInputDescriptor<StreamMessageType> withConsumerAutoOffsetReset(String consumerAutoOffsetReset) {
    this.consumerAutoOffsetResetOptional = Optional.of(StringUtils.stripToNull(consumerAutoOffsetReset));
    return this;
}

From source file:org.apache.samza.system.kafka.KafkaSystemDescriptor.java

/**
 * This setting determines what happens if a consumer attempts to read an offset that is outside of the current
 * valid range. This could happen if the topic does not exist, or if a checkpoint is older than the maximum message
 * history retained by the brokers. This property is not to be confused with {@link InputDescriptor#withOffsetDefault},
 * which determines what happens if there is no checkpoint.
 * <p>// w w w .  j av  a  2 s .c  o  m
 * The following are valid values for auto.offset.reset:
 * <ul>
 *   <li>smallest: Start consuming at the smallest (oldest) offset available on the broker
 *   (process as much message history as available).
 *   <li>largest: Start consuming at the largest (newest) offset available on the broker
 *   (skip any messages published while the job was not running).
 *   <li>anything else: Throw an exception and refuse to start up the job.
 * </ul>
 * <p>
 * Note: This property may be set at a topic level using {@link KafkaInputDescriptor#withConsumerAutoOffsetReset}
 *
 * @param consumerAutoOffsetReset consumer auto offset reset policy for the system
 * @return this system descriptor
 */
public KafkaSystemDescriptor withConsumerAutoOffsetReset(String consumerAutoOffsetReset) {
    this.consumerAutoOffsetResetOptional = Optional.of(StringUtils.stripToNull(consumerAutoOffsetReset));
    return this;
}

From source file:org.apache.samza.system.kinesis.descriptors.KinesisInputDescriptor.java

/**
 * Kinesis region for the system stream.
 * @param region Kinesis region//w w  w .  j  ava  2s .c  o  m
 * @return this input descriptor
 */
public KinesisInputDescriptor<StreamMessageType> withRegion(String region) {
    this.region = Optional.ofNullable(StringUtils.stripToNull(region));
    return this;
}

From source file:org.apache.samza.system.kinesis.descriptors.KinesisInputDescriptor.java

/**
 * Kinesis access key name for the system stream.
 * @param accessKey Kinesis access key name
 * @return this input descriptor//from w  w  w .j  a va2  s . co m
 */
public KinesisInputDescriptor<StreamMessageType> withAccessKey(String accessKey) {
    this.accessKey = Optional.ofNullable(StringUtils.stripToNull(accessKey));
    return this;
}

From source file:org.apache.samza.system.kinesis.descriptors.KinesisInputDescriptor.java

/**
 * Kinesis secret key name for the system stream.
 * @param secretKey Kinesis secret key/*from  w  w w.j ava2s.  c o m*/
 * @return this input descriptor
 */
public KinesisInputDescriptor<StreamMessageType> withSecretKey(String secretKey) {
    this.secretKey = Optional.ofNullable(StringUtils.stripToNull(secretKey));
    return this;
}

From source file:org.apache.samza.system.kinesis.descriptors.KinesisSystemDescriptor.java

/**
 * Kinesis region for this system./*  w w w  .j  a v a 2s.c  o m*/
 * @param region Kinesis region
 * @return this system descriptor
 */
public KinesisSystemDescriptor withRegion(String region) {
    this.region = Optional.ofNullable(StringUtils.stripToNull(region));
    return this;
}

From source file:org.apache.samza.system.kinesis.descriptors.KinesisSystemDescriptor.java

/**
 * Proxy host to be used for this system.
 * @param proxyHost Proxy host//from ww  w  .j a v  a  2s.c om
 * @return this system descriptor
 */
public KinesisSystemDescriptor withProxyHost(String proxyHost) {
    this.proxyHost = Optional.ofNullable(StringUtils.stripToNull(proxyHost));
    return this;
}

From source file:org.drombler.acp.core.action.impl.ActionAnnotationProcessor.java

private void configureAction(ActionType action, String id, String category, String displayName,
        String accelerator, String icon, Element element) {
    action.setId(StringUtils.stripToNull(id));
    action.setCategory(StringUtils.stripToNull(category));
    action.setDisplayName(StringUtils.stripToNull(displayName));
    action.setAccelerator(StringUtils.stripToNull(accelerator));
    action.setIcon(StringUtils.stripToNull(icon));
    action.setListenerClass(element.asType().toString());
}