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:com.javaetmoi.core.spring.vfs.Vfs2Resource.java

public Vfs2Resource(Object resources) {
    Assert.notNull(resources, "VirtualFile must not be null");
    this.resource = resources;
}

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

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

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

    Item javaChip = new Item("Java Chip", new MonetaryAmount(EURO, 4.20));
    Item cappuchino = new Item("Cappuchino", new MonetaryAmount(EURO, 3.20));

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

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

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

@Override
public void validate(final Object object, final Errors errors) {
    Assert.notNull(errors, "Errors object must not be null");
    final String fieldValue = (String) errors.getFieldValue(fieldPath);
    final String resultErrorMessageId = errorMessageId != null ? errorMessageId
            : FIELD_REQUIRED_AND_NOT_TOO_LONG_MESSAGE_ID;

    if (StringUtils.isBlank(fieldValue) || StringUtils.length(fieldValue) > maxLength) {
        errors.rejectValue(fieldPath, resultErrorMessageId, new String[] { String.valueOf(maxLength) }, null);
    }/*  w w  w .j  a v a2 s.  co m*/
}

From source file:org.cleverbus.core.alerts.AlertsJdbcDao.java

@Autowired
@Qualifier(value = "dataSource")
public void setDataSource(DataSource dataSource) {
    Assert.notNull(dataSource, "dataSource must not be empty!");

    this.template = new JdbcTemplate(dataSource);
}

From source file:org.spring.data.gemfire.app.beans.Account.java

public Account(final Long customerId) {
    Assert.notNull(customerId, "The Customer ID to which this Account belongs cannot be null!");
    this.customerId = customerId;
}

From source file:org.juiser.spring.security.authentication.ClaimsGrantedAuthoritiesResolver.java

public ClaimsGrantedAuthoritiesResolver(Function<Claims, Collection<String>> authorityStringsResolver) {
    Assert.notNull(authorityStringsResolver, "authorityStringsResolver cannot be null.");
    this.authorityStringsResolver = authorityStringsResolver;
}

From source file:biz.c24.io.spring.integration.selector.AbstractXPathMessageSelector.java

public AbstractXPathMessageSelector(String statement) {
    Assert.notNull(statement, "The XPath statement must not be null.");

    this.statement = new XPathStatement(statement);
}

From source file:com.sybase365.mobiliser.custom.project.persistence.dao.hibernate.factory.HibernateDaoFactoryImpl.java

@Override
public void afterPropertiesSet() {
    Assert.notNull(this.blacklistDao, "blacklistDao is required");
    Assert.notNull(this.blacklistTypeDao, "blacklistTypeDao is required");
}

From source file:org.springmodules.validation.util.condition.date.IsBeforeDateCondition.java

/**
 * Constructs a new IsBeforeDateCondition with a given date to be compared with the checked calendar.
 *
 * @param later The date to be compared with the checked calendar.
 *//*from   w w  w. ja v a  2  s  .c o m*/
public IsBeforeDateCondition(Date later) {
    Assert.notNull(later, "IsBeforeDateCondition cannot be initialized with a null date");
    this.later = Calendar.getInstance();
    this.later.setTime(later);
}

From source file:com.azaptree.services.domain.entity.impl.DomainEntityAuditLogRecord.java

public DomainEntityAuditLogRecord(final Entity entity, final AuditAction auditAction) {
    Assert.notNull(entity, "entity is required");
    Assert.notNull(auditAction, "auditAction is required");
    setEntityId(UUID.randomUUID());
    setEntityAuditlogRecordCreatedOn(System.currentTimeMillis());
    setAuditedEntityId(entity.getEntityId());
    setAuditAction(auditAction);/*  w  w w . ja  v  a2s . c  om*/
    setEntityType(entity.getClass().getName());
    setEntityJson(entity.toJson());
}