Example usage for org.springframework.util Assert hasText

List of usage examples for org.springframework.util Assert hasText

Introduction

In this page you can find the example usage for org.springframework.util Assert hasText.

Prototype

@Deprecated
public static void hasText(@Nullable String text) 

Source Link

Document

Assert that the given String contains valid text content; that is, it must not be null and must contain at least one non-whitespace character.

Usage

From source file:se.vgregion.mobile.types.ErrorReport.java

public ErrorReport(Printer printer, PrinterQueue queue, String reporter, String description) {
    Assert.notNull(printer);/*from w ww. j a  va 2  s .  c o m*/
    Assert.hasText(description);

    this.id = UUID.randomUUID();
    this.printer = printer;
    this.queue = queue;
    this.reporter = reporter;
    this.description = description;
}

From source file:com.github.spring.example.ImageService.java

@Cacheable("qr-code-cache")
public byte[] generateQRCode(String text, int width, int height) throws WriterException, IOException {

    Assert.hasText(text);
    Assert.isTrue(width > 0);/*from  w w  w.  jav  a  2 s . co  m*/
    Assert.isTrue(height > 0);

    LOGGER.info("Will generate image  text=[{}], width=[{}], height=[{}]", text, width, height);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BitMatrix matrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height);
    MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), baos,
            new MatrixToImageConfig());
    return baos.toByteArray();
}

From source file:com.travelport.restneohack.model.domain.Traveler.java

public Traveler(String firstName, String lastName, String emailAddress) {

    Assert.hasText(firstName);
    Assert.hasText(lastName);//from  ww w. j a v  a 2s .  c  om
    Assert.hasText(emailAddress);

    this.firstName = firstName;
    this.lastName = lastName;
    this.emailAddress = emailAddress;
}

From source file:com.icfcc.cache.interceptor.CacheOperation.java

public void setCacheName(String cacheName) {
    Assert.hasText(cacheName);
    this.cacheNames = Collections.singleton(cacheName);
}

From source file:com.ktds.ldap.populator.ContextSourceEc2InstanceLaunchingFactoryBean.java

@Override
protected final Object doCreateInstance(final String dnsName) throws Exception {
    Assert.hasText(userDn);
    LdapContextSource instance = new LdapContextSource();
    instance.setUrl("ldap://" + dnsName);
    instance.setUserDn(userDn);//from  w w  w . j  a  va  2 s  . c o m
    instance.setPassword(password);
    instance.setBase(base);
    instance.setPooled(pooled);
    setAdditionalContextSourceProperties(instance, dnsName);

    instance.afterPropertiesSet();
    return instance;
}

From source file:com.eheobo.samples.shiro.dao.UserDao.java

public User findUser(String username) {
    Assert.hasText(username);
    String query = "from User u where u.username = :username";
    return (User) getSession().createQuery(query).setString("username", username).uniqueResult();
}

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

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

From source file:org.italiangrid.storm.webdav.authz.vomap.MapfileVOMembershipSource.java

public MapfileVOMembershipSource(String voName, File mapFile) {

    Assert.hasText(voName);
    Assert.notNull(mapFile);/*  w ww  .ja  v a  2  s  .  c  o  m*/

    this.voName = voName;
    this.mapFile = mapFile;

}

From source file:mx.uaq.facturacion.enlace.EmailFragment.java

/**
 * Constructor.//from   www.  j av  a 2  s.  co  m
 *
 * @param directory Must not be null
 * @param filename  Must not be null
 * @param data  Must not be null
 */
public EmailFragment(File directory, String filename, Object data) {
    super();

    Assert.notNull(directory);
    Assert.hasText(filename);
    Assert.notNull(data);

    this.directory = directory;
    this.filename = filename;
    this.data = data;
}

From source file:org.pentaho.di.trans.dataservice.ui.controller.DataServiceRemapNoStepsDialogControllerTest.java

@Test
public void testController() {
    SwtDialog dialog = mock(SwtDialog.class);

    DataServiceRemapNoStepsDialogController controller = spy(new DataServiceRemapNoStepsDialogController());
    Assert.hasText(controller.getName());
    doReturn(dialog).when(controller).getElementById(anyString());
    controller.close();/*www .  j  av a  2 s .c  o  m*/
    verify(dialog).dispose();
}