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:doge.photo.PhotoResource.java

public PhotoResource(Photo photo) {
    Assert.notNull(photo, "Photo must not be null");
    this.photo = photo;
}

From source file:fr.mby.portal.coreimpl.preferences.BasicAppPreferences.java

/** Protected constructor. */
protected BasicAppPreferences(final Map<String, String[]> preferences) {
    super();//from   ww w.ja  v a2 s .  c o  m

    Assert.notNull(preferences, "No preferences Map supplied !");

    this.preferences = preferences;
}

From source file:Main.java

/**
 * Checks in under a given root element whether it can find a child element
 * which matches the XPath expression supplied. The {@link Element} must
 * exist. Returns {@link Element} if exists.
 * /*from   w  w  w. java2s  . c o  m*/
 * Please note that the XPath parser used is NOT namespace aware. So if you
 * want to find a element <beans><sec:http> you need to use the following
 * XPath expression '/beans/http'.
 * 
 * @param xPathExpression the xPathExpression (required)
 * @param root the parent DOM element (required)
 * 
 * @return the Element if discovered (never null; an exception is thrown if
 *         cannot be found)
 */
public static Element findRequiredElement(String xPathExpression, Element root) {
    Assert.hasText(xPathExpression, "XPath expression required");
    Assert.notNull(root, "Root element required");
    Element element = findFirstElement(xPathExpression, root);
    Assert.notNull(element,
            "Unable to obtain required element '" + xPathExpression + "' from element '" + root + "'");
    return element;
}

From source file:com.iflytek.edu.cloud.frame.error.MainErrors.java

private static String getErrorMessage(String code, Locale locale) {
    try {// w  w  w  .j a  va  2 s .com
        Assert.notNull(errorMessageSourceAccessor, "??");
        return errorMessageSourceAccessor.getMessage(code, new Object[] {}, locale);
    } catch (NoSuchMessageException e) {
        logger.error("?{}?i18n/rop/error?",
                code);
        throw e;
    }
}

From source file:org.hdiv.config.annotation.RuleRegistration.java

public RuleRegistration componentType(String componentType) {
    Assert.notNull(componentType, "Component type is required");
    this.validation.setComponentType(componentType);
    return this;
}

From source file:com.ewcms.web.pubsub.ProgressSender.java

private WebPublishFacable getPublishFac(ServletContext context) {

    ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
    Assert.notNull(applicationContext, "Can not get spring's context");

    WebPublishFacable fac = applicationContext.getBean("webPublishFac", WebPublishFacable.class);
    Assert.notNull(fac, "Can not get webPublishFacBean");

    return fac;/*from  w ww . ja va2s. co m*/
}

From source file:com.acc.customer.populator.ExtendedCustomerPopulator.java

@Override
public void populate(final CustomerModel source, final CustomerData target) throws ConversionException {
    Assert.notNull(source, "Parameter source cannot be null.");
    Assert.notNull(target, "Parameter target cannot be null.");

    if (source.getTitle() != null) {
        target.setTitle(source.getTitle().getName());
    }/*from www .j  ava 2 s  . c o m*/
}

From source file:cz.clovekvtisni.coordinator.server.security.PermissionExpressionRootObject.java

public PermissionExpressionRootObject(Method method, Object[] args, Object target) {
    Assert.notNull(method, "Method is required");
    this.method = method;
    this.target = target;
    this.args = args;
}

From source file:com.wavemaker.commons.io.ResourcesCollection.java

public ResourcesCollection(Folder source, Collection<T> resources) {
    Assert.notNull(source, "Source must not be null");
    Assert.notNull(resources, "Resources must not be null");
    this.source = source;
    this.resources = resources;
}

From source file:com.azaptree.services.domain.entity.dao.SearchResults.java

public SearchResults(final Page page, final long totalCount, final List<T> data) {
    Assert.notNull(page, "page is required");
    Assert.notNull(data, "data is required");
    this.page = page;
    this.totalCount = totalCount;
    this.data = data;
}