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.apache.mina.springrpc.MinaClientHandler.java

public MinaClientHandler(ResultReceiver resultReceiver, MinaRequestExecutor requestExecutor) {
    Assert.notNull(resultReceiver, "resultReceiver required");
    Assert.notNull(requestExecutor, "requestExecutor required");
    this.resultReceiver = resultReceiver;
    this.requestExecutor = requestExecutor;
}

From source file:org.codehaus.groovy.grails.plugins.searchable.compass.support.AbstractSearchableMethod.java

public AbstractSearchableMethod(String methodName, Compass compass, Map defaultOptions) {
    Assert.notNull(methodName, "methodName cannot be null");
    Assert.notNull(compass, "compass cannot be null");
    this.methodName = methodName;
    this.compass = compass;
    this.defaultOptions = defaultOptions;
}

From source file:org.cleverbus.api.common.ExchangeHelper.java

/**
 * Propagates (copies) the {@code Body}, the {@code Attachments} and the {@code Headers} of the {@link Message}
 * from from IN to OUT.//  w ww .jav  a  2s. c  om
 *
 * @param exchange the exchange message
 */
public static void propagateMessage(Exchange exchange) {
    Assert.notNull(exchange, "the exchange must not be null");

    // copy headers from IN to OUT to propagate them
    exchange.getOut().setHeaders(exchange.getIn().getHeaders());
    // copy attachments from IN to OUT to propagate them
    exchange.getOut().setAttachments(exchange.getIn().getAttachments());
    // copy body from IN to OUT to propagate it
    exchange.getOut().setBody(exchange.getIn().getBody());
}

From source file:io.spring.initializr.generator.ProjectRequestResolver.java

public ProjectRequest resolve(ProjectRequest request, InitializrMetadata metadata) {
    Assert.notNull(request, "Request must not be null");
    applyPostProcessBeforeResolution(request, metadata);
    request.resolve(metadata);//from w  w w.  ja  v  a  2 s. co  m
    applyPostProcessAfterResolution(request, metadata);
    return request;
}

From source file:com.googlecode.spring.appengine.cache.memcache.MemcacheCache.java

public MemcacheCache(MemcacheService memcacheService) {
    Assert.notNull(memcacheService, "MemcacheService must not be null");
    this.memcacheService = memcacheService;
}

From source file:fr.mby.portal.coreimpl.user.BasicUserDetailsFactory.java

@Override
public IUserDetails build(final Principal principal, final boolean isAuthenticated, final Set<IRole> roles,
        final Map<String, String> details) {
    Assert.notNull(principal, "No principal supplied !");

    final BasicUserDetails userDetails = new BasicUserDetails();
    userDetails.setPrincipal(principal);
    userDetails.setAuthenticated(isAuthenticated);

    if (roles != null) {
        userDetails.setRoles(roles);//from w w w  . j a  va  2s.  co m
    } else {
        userDetails.setRoles(Collections.<IRole>emptySet());
    }

    if (details != null) {
        userDetails.setDetails(details);
    } else {
        userDetails.setDetails(Collections.<String, String>emptyMap());
    }

    return userDetails;
}

From source file:cn.guoyukun.spring.jpa.repository.RepositoryHelper.java

public static EntityManager getEntityManager() {
    Assert.notNull(entityManager, "entityManager must null, please see "
            + "[cn.guoyukun.spring.jpa.repository.RepositoryHelper#setEntityManagerFactory]");

    return entityManager;
}

From source file:gov.nyc.doitt.gis.geoclient.parser.regex.Match.java

public Match(ParseContext parseContext, MatchType matchType, Matcher matcher,
        List<RegexTokenGroup> matchGroups) {
    super();/*from  w w  w.  ja  va2  s.  c om*/
    Assert.notNull(parseContext, "ParseContext argument cannot be null.");
    this.parseContext = parseContext;
    Assert.notNull(matchType, "MatchType argument cannot be null.");
    this.matchType = matchType;
    Assert.notNull(matcher, "MatchResult argument cannot be null.");
    this.matcher = matcher;
    Assert.notEmpty(matchGroups, "List<RegexTokenGroup> argument cannot be empty or null.");
    this.matchGroups = matchGroups;
}

From source file:com.appdynamics.cloudfoundry.appdservicebroker.catalog.Plan.java

UUID getId() {
    synchronized (this.monitor) {
        Assert.notNull(this.id, "Plans must specify an id");
        return this.id;
    }//from   ww w.  j  a v  a  2s . c om
}

From source file:org.springsource.restbucks.order.OrderInitializer.java

/**
 * Creates two orders and persists them using the given {@link OrderRepository}.
 * /*from  w  w w.jav  a 2 s.  c  o  m*/
 * @param orders must not be {@literal null}.
 */
@Autowired
public OrderInitializer(OrderRepository orders) {

    Assert.notNull(orders, "OrderRepository must not be null!");

    if (orders.count() != 0) {
        return;
    }

    LineItem javaChip = new LineItem("Java Chip", Money.of(4.20, EURO));
    LineItem cappuchino = new LineItem("Cappuchino", Money.of(3.20, EURO));

    Order javaChipOrder = new Order(javaChip);
    Order cappuchinoOrder = new Order(cappuchino);

    orders.save(Arrays.asList(javaChipOrder, cappuchinoOrder));
}