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

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

Introduction

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

Prototype

public static boolean isEmpty(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is empty ("") or null.

 StringUtils.isEmpty(null)      = true StringUtils.isEmpty("")        = true StringUtils.isEmpty(" ")       = false StringUtils.isEmpty("bob")     = false StringUtils.isEmpty("  bob  ") = false 

NOTE: This method changed in Lang version 2.0.

Usage

From source file:com.adaptris.core.jms.MessageIdCorrelationIdSource.java

@Override
public void processCorrelationId(Message src, AdaptrisMessage dest) throws JMSException {
    String id = src.getJMSCorrelationID();
    if (!StringUtils.isEmpty(id)) {
        dest.setUniqueId(id);/*from  w ww  .ja  v a  2  s . co  m*/
    } else {
        log.debug("No JMSCorrelationID; not modifying unique-id");
    }
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.GetMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    GetMapping mappingAnnotation = (GetMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.GET, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }/*from   w ww . ja  v  a  2 s .c  o m*/
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PutMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PutMapping mappingAnnotation = (PutMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.PUT, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }/*from  ww w.j ava 2 s.  c om*/
}

From source file:com.jxt.web.filter.FilterDescriptor.java

public boolean isValidFromToInfo() {
    return !(StringUtils.isEmpty(fromApplicationName) || StringUtils.isEmpty(fromServiceType)
            || StringUtils.isEmpty(toApplicationName) || StringUtils.isEmpty(toServiceType));
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PostMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PostMapping mappingAnnotation = (PostMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.POST, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }//w  ww  .j  a va2  s .c  o  m
}

From source file:com.esri.geoevent.test.performance.ui.ProducerUI.java

@Override
public void start(Stage primaryStage) {
    String modeStr = "Producer";
    if (StringUtils.isEmpty(modeStr)) {
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_NULL")
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();//ww  w  . j a v a2s.  c  o  m
        System.exit(0);
        return;
    }

    Mode mode = Mode.fromValue(modeStr);
    String fxmlFile = "";
    Object controller = null;
    switch (mode) {
    case Producer:
        fxmlFile = "PerformanceCollector.fxml";
        controller = new ProducerController();
        break;
    default:
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_UNKNOWN", mode)
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();
        System.exit(0);
        return;
    }

    Platform.setImplicitExit(true);
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFile));
        if (controller != null) {
            loader.setController(controller);
        }
        Parent parent = (Parent) loader.load();
        Scene scene = new Scene(parent);

        primaryStage.setOnCloseRequest(new AppCloser());
        primaryStage.setTitle(UIMessages.getMessage("UI_TITLE", mode));
        primaryStage.setScene(scene);
        primaryStage.show();
        ProducerUI.primaryStage = primaryStage;
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PatchMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PatchMapping mappingAnnotation = (PatchMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.PATCH, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }/*  w ww  .j a  va2s.  c  om*/
}

From source file:org.red5.webapps.admin.controllers.service.UserDetailsValidator.java

public void validate(Object obj, Errors errors) {
    log.debug("validate");
    AdminUserDetails ud = (AdminUserDetails) obj;
    if (ud == null) {
        log.debug("User details were null");
        errors.rejectValue("username", "error.not-specified", null, "Value required.");
    } else {//from   w ww  .  j ava  2  s  . c o  m
        log.debug("User details were null");
        if (StringUtils.isEmpty(ud.getUsername())) {
            errors.rejectValue("username", "error.missing-username", new Object[] {}, "Username Required.");
        }
        if (StringUtils.isEmpty(ud.getPassword())) {
            errors.rejectValue("password", "error.missing-password", new Object[] {}, "Password Required.");
        } else if (ud.getPassword().length() < minLength) {
            errors.rejectValue("password", "error.too-low", new Object[] { new Integer(minLength) },
                    "Password Length Is Too Small.");
        }
    }
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.RequestMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    RequestMapping requestMapping = (RequestMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(requestMapping.path(), operationGenerator);
    this.processPath(requestMapping.value(), operationGenerator);
    this.processMethod(requestMapping.method(), operationGenerator);

    this.processConsumes(requestMapping.consumes(), operation);
    this.processProduces(requestMapping.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }/*w w  w. j av  a 2s. co m*/
}

From source file:com.github.rvesse.airline.model.CommandGroupMetadata.java

public CommandGroupMetadata(String name, String description, boolean hidden, Iterable<OptionMetadata> options,
        Iterable<CommandGroupMetadata> subGroups, CommandMetadata defaultCommand,
        Iterable<CommandMetadata> commands) {
    //@formatter:on
    if (StringUtils.isEmpty(name))
        throw new IllegalArgumentException("Group name may not be null/empty");
    if (StringUtils.containsWhitespace(name))
        throw new IllegalArgumentException("Group name may not contain whitespace");

    this.name = name;
    this.description = description;
    this.hidden = hidden;
    this.options = AirlineUtils.unmodifiableListCopy(options);
    this.subGroups = AirlineUtils.listCopy(subGroups);
    this.defaultCommand = defaultCommand;
    this.commands = AirlineUtils.listCopy(commands);
    if (this.defaultCommand != null && !this.commands.contains(this.defaultCommand)) {
        this.commands.add(this.defaultCommand);
    }/*from www  . j  a  v a2s  .c om*/
}