Example usage for org.springframework.util Assert notNull

List of usage examples for org.springframework.util Assert notNull

Introduction

In this page you can find the example usage for org.springframework.util Assert notNull.

Prototype

public static void notNull(@Nullable Object object, Supplier<String> messageSupplier) 

Source Link

Document

Assert that an object is not null .

Usage

From source file:org.jasig.cas.authentication.principal.HttpBasedServiceCredentials.java

/**
 * Constructor that takes the URL of the HTTP-based service and creates the
 * Credentials object. Caches the value of URL.toExternalForm so updates to
 * the URL will not be reflected in a call to toString().
 * //from   w  ww.  j av  a2 s  . co m
 * @param callbackUrl the URL representing the service
 * @throws IllegalArgumentException if the callbackUrl is null.
 */
public HttpBasedServiceCredentials(final URL callbackUrl) {
    Assert.notNull(callbackUrl, "callbackUrl cannot be null");
    this.callbackUrl = callbackUrl;
    this.callbackUrlAsString = callbackUrl.toExternalForm();
}

From source file:org.cleverbus.api.route.AbstractExtRoute.java

/**
 * Gets route ID for asynchronous incoming routes, specific for extension routes.
 *
 * @param service       the service name
 * @param operationName the operation name
 * @return route ID//  w  w  w  .ja  va  2  s .  c om
 * @see #getInRouteId(ServiceExtEnum, String)
 */
public static String getExtInRouteId(ServiceExtEnum service, String operationName) {
    Assert.notNull(service, "the service must not be null");
    Assert.hasText(operationName, "the operationName must not be empty");

    return service.getServiceName() + "_" + operationName + EXT_IN_ROUTE_SUFFIX;
}

From source file:fr.mby.portal.coreimpl.message.AbstractReply.java

@Override
public void setProperty(final String key, final String value) throws IllegalArgumentException {
    Assert.notNull(key, "Key provided is null !");
    this.properties.put(key, value);
}

From source file:org.cleverbus.api.event.AbstractAsynchEvent.java

/**
 * Creates new event./*from w w  w  . ja va2  s.  c o  m*/
 *
 * @param exchange the exchange
 * @param message the message
 */
public AbstractAsynchEvent(Exchange exchange, Message message) {
    super(exchange);

    Assert.notNull(message, "message must not be null");

    this.message = message;
}

From source file:org.arrow.util.DelegateUtil.java

/**
 * Creates a new {@link TransitionEvaluation} instance of the
 * class with the given name. Throws an IllegalArgumentException if the
 * class could not be instantiated.// ww w .  j av a2  s.c o  m
 *
 * @param className the transition evaluation class name
 * @return JavaDelegate
 */
public static TransitionEvaluation getTransitionEvaluation(String className) {

    Assert.notNull(className, "className must not be null");

    try {
        if (cache.containsKey(className)) {
            Object obj = cache.get(className);
            return (TransitionEvaluation) obj;
        }

        Class<?> clazz = Class.forName(className);
        TransitionEvaluation evaluation;
        evaluation = (TransitionEvaluation) clazz.newInstance();

        cache.put(className, evaluation);
        return evaluation;
    } catch (Exception e) {
        throw new IllegalArgumentException("transition evaluation delegation error", e);
    }
}

From source file:org.cleverbus.admin.services.MessageReportServiceImpl.java

@Override
public List<MessageReportDto> getMessageStateSummary(Date startDate, Date endDate) {
    Assert.notNull(startDate, "startDate mustn't be null");
    Assert.notNull(endDate, "startDate mustn't be null");

    // adjust dates to start from 0.00 and end 23.59
    DateTime from = new DateTime(startDate).withTimeAtStartOfDay();
    DateTime to = new DateTime(endDate).plusDays(1).withTimeAtStartOfDay();

    return dao.getMessageStateSummary(from.toDate(), to.toDate());
}

From source file:biz.deinum.multitenant.validation.AbstractSimpleClassMappingValidator.java

public void afterPropertiesSet() throws Exception {
    Assert.notNull(this.supportedClass, "'SupportedClass' must be set!");
    Assert.notNull(this.field, "'Field' must be set!");
}

From source file:com.acc.validator.ReviewDataValidator.java

protected void validateRating(final Errors errors) {
    Assert.notNull(errors, "Errors object must not be null");
    final Double rating = (Double) errors.getFieldValue(RATING);

    if (rating == null) {
        errors.rejectValue(RATING, "field.required");
    } else {//from  ww w . j  a  v a  2s .c  o m
        if (rating.doubleValue() < RATING_MIN || rating.doubleValue() > RATING_MAX) {
            errors.rejectValue(RATING, "review.rating.invalid");
        }
    }
}

From source file:com.acmemotors.batch.support.GatewayItemWriter.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notNull(gateway, "A RequestGateway is required");
}

From source file:org.vertx.mods.examples.beans.AbstractEcho.java

public void setVertx(Vertx vertx) {
    Assert.notNull(vertx, "Vertx must not be null");
    this.vertx = vertx;
}