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

@Deprecated
public static void notNull(@Nullable Object object) 

Source Link

Document

Assert that an object is not null .

Usage

From source file:converters.StringToVoteConverter.java

@Override
public Vote convert(String key) {
    Assert.hasText(key);//ww w. j av a 2  s.  c  o  m

    Vote result;
    int id;

    id = Integer.valueOf(key);
    result = voteRepository.findOne(id);
    Assert.notNull(result);

    return result;
}

From source file:com.joyveb.dbpimpl.cass.prepare.schema.CqlColumn.java

public CqlColumn(String name, DataType type) {
    Assert.notNull(name);
    Assert.notNull(type);

    this.name = name;
    this.type = type;
}

From source file:io.twipple.springframework.data.clusterpoint.convert.support.ConversionUtils.java

/**
 * Returns a collection from the given source object.
 *
 * @param source the source object./* ww w  .jav a  2  s.c o  m*/
 * @return the target collection.
 */
@NotNull
public static Collection<?> asCollection(@NotNull Object source) {

    Assert.notNull(source);

    if (source instanceof Collection) {
        return (Collection<?>) source;
    }

    if (source.getClass().isArray()) {
        return CollectionUtils.arrayToList(source);
    }

    return Collections.singleton(source);
}

From source file:com.iterzp.momo.utils.JsonUtils.java

/**
 * JSON?//from ww w  . jav  a 2  s . co m
 * 
 * @param json
 *            JSON
 * @param typeReference
 *            
 * @return 
 */
public static <T> T toObject(String json, TypeReference<?> typeReference) {
    Assert.hasText(json);
    Assert.notNull(typeReference);
    try {
        return mapper.readValue(json, typeReference);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.google.code.guice.repository.spi.TypeUtil.java

/**
 * Finds and returns class of first parametrization parameter.
 *
 * @param aClass generic class//from   w  ww . j a v  a2 s .c  om
 *
 * @return parameter class or {@code null} if parameter can't be found
 *
 * @throws IllegalArgumentException if specified {@code aClass} is null
 */
public static Class getFirstTypeParameterClass(Class aClass) {
    Assert.notNull(aClass);
    return getTypeParameterClass(aClass, 0);
}

From source file:converters.StringToVotationConverter.java

@Override
public Votation convert(String key) {
    Assert.hasText(key);// w  ww  . j a va  2s.c  o  m

    Votation result;
    int id;

    id = Integer.valueOf(key);
    result = votationRepository.findOne(id);
    Assert.notNull(result);

    return result;
}

From source file:com.joyveb.dbpimpl.cass.prepare.spec.ColumnTypeChangeSpecification.java

private void setType(DataType type) {
    Assert.notNull(type);
    this.type = type;
}

From source file:net.groupbuy.service.impl.RSAServiceImpl.java

@Transactional(readOnly = true)
public RSAPublicKey generateKey(HttpServletRequest request) {
    Assert.notNull(request);
    KeyPair keyPair = RSAUtils.generateKeyPair();
    RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
    RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
    HttpSession session = request.getSession();
    session.setAttribute(PRIVATE_KEY_ATTRIBUTE_NAME, privateKey);
    return publicKey;
}

From source file:org.cleverbus.admin.services.log.LogEvent.java

public LogEvent(LogParserConfig config) {
    Assert.notNull(config);
    this.config = config;
    this.properties = new Object[config.getPropertyCount()];
}

From source file:org.mule.modules.automation.testcases.GetRoleDetailTestCases.java

@Category({ RegressionTests.class, SmokeTests.class })
@Test/* ww w.java2 s . c  om*/
public void testGetRoleDetail() throws Exception {
    Role role = runFlowAndGetPayload("get-role-detail");
    Assert.notNull(role);
    Assert.isTrue(role.getId() == 3);
    Assert.isTrue(!role.getInherited());
    Assert.isTrue(role.getName().contentEquals("Manager"));
    Assert.notNull(role.getPermissions());
}