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:br.com.insula.spring.security.janrain.Janrain.java

public String getTokenUrl(HttpServletRequest request, String path) {
    Assert.notNull(request, "'request' cannot be null");
    Assert.notNull(request, "'path' cannot be null");
    Assert.isTrue(path.startsWith("/"), "path must start with '/'");
    String scheme = request.getScheme();
    int serverPort = request.getServerPort();
    if (isRequestInDefaultPort(scheme, serverPort)) {
        return String.format("%s://%s%s", scheme, request.getServerName(), path);
    } else {//from  w  ww  . j a v a  2 s . c  o m
        return String.format("%s://%s:%d%s", scheme, request.getServerName(), serverPort, path);
    }
}

From source file:com.berwickheights.spring.mvc.controller.ErrorPageController.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notNull(viewName, "viewName must be set");
}

From source file:io.curly.tagger.service.DefaultTagService.java

@Inject
DefaultTagService(TagRepository repository) {
    Assert.notNull(repository, "TagRepository must be not null!");
    this.repository = repository;
}

From source file:com.github.jmnarloch.spring.cloud.feign.BaseRequestInterceptor.java

/**
 * Creates new instance of {@link BaseRequestInterceptor}.
 *
 * @param properties the encoding properties
 *//*from w w w .j  a va 2 s .c  om*/
protected BaseRequestInterceptor(FeignClientEncodingProperties properties) {
    Assert.notNull(properties, "Properties can not be null");
    this.properties = properties;
}

From source file:org.covito.kit.cache.support.EhCache.java

/**
 * Constructor//from  w  w  w .j a v a2  s  .  c  om
 * 
 * @param cacheManager
 * @param cache
 */
public EhCache(Ehcache cache) {
    Assert.notNull(cache, "Ehcache must not be null");
    Status status = cache.getStatus();
    Assert.isTrue(Status.STATUS_ALIVE.equals(status),
            "An 'alive' Ehcache is required - current cache is " + status.toString());
    this.cache = cache;
}

From source file:com.ewcms.publication.freemarker.loader.DatabaseTemplateLoader.java

@Override
public Object findTemplateSource(String name) throws IOException {
    Assert.notNull(name, "template uniquepath is null");

    String path = StringUtils.removeStart(name, "/");
    TemplateBody body = templatePublishDao.findBody(path);

    if (body == null) {
        logger.debug("{} is not exist.", path);
        return null;
    }/* w  w w.j  a va2s  .  c om*/

    byte[] content = body.getBody();
    long lastTime = System.currentTimeMillis();

    return new TemplateSource(path, content, lastTime);
}

From source file:com.icfcc.cache.ehcache.EhCacheCache.java

/**
 * Create an {@link EhCacheCache} instance.
 * @param ehcache backing Ehcache instance
 *///  w  ww . j a va2s .  c  om
public EhCacheCache(Ehcache ehcache) {
    Assert.notNull(ehcache, "Ehcache must not be null");
    Status status = ehcache.getStatus();
    Assert.isTrue(Status.STATUS_ALIVE.equals(status),
            "An 'alive' Ehcache is required - current cache is " + status.toString());
    this.cache = ehcache;
}

From source file:org.eclipse.swordfish.core.event.ConfigurationEventImpl.java

public void setAction(Action action) {
    Assert.notNull(action, "The supplied action parameter can not be null");
    this.action = action;
}

From source file:com.ewcms.publication.freemarker.cache.DatabaseTemplateLoader.java

@Override
public Object findTemplateSource(String name) throws IOException {
    Assert.notNull(name, "template uniquepath is null");

    String path = StringUtils.removeStart(name, "/");
    Template template = templateService.getTemplateByUniquePath(path);

    if (template == null) {
        logger.debug("{} is not exist.", path);
        return null;
    }//from   w  w w  .  j  ava2s .c o m

    TemplateEntity entity = template.getTemplateEntity();
    if (entity == null) {
        logger.debug("{} content is null", path);
        return null;
    }

    byte[] content = entity.getTplEntity();
    long lastTime = template.getUpdTime().getTime();

    return new TemplateSource(path, content, lastTime);
}

From source file:com.mitchellbosecke.pebble.spring.context.Beans.java

@Override
public boolean containsKey(Object key) {
    Assert.notNull(key, "Key cannot be null");
    return this.ctx.containsBean(key.toString());
}