Example usage for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable

List of usage examples for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable

Introduction

In this page you can find the example usage for org.springframework.context.support DefaultMessageSourceResolvable DefaultMessageSourceResolvable.

Prototype

public DefaultMessageSourceResolvable(@Nullable String[] codes, @Nullable Object[] arguments,
        @Nullable String defaultMessage) 

Source Link

Document

Create a new DefaultMessageSourceResolvable.

Usage

From source file:com.apress.prospringintegration.corespring.i18n.MainI18n.java

public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("ioc_resource_bundles.xml");

    String qMessage = ctx.getMessage("queued", null, Locale.US);
    System.out.println(qMessage);

    qMessage = ctx.getMessage("queued", null, Locale.UK);
    System.out.println(qMessage);

    String filename = "ProSpringIntegration.xml";
    MessageSourceResolvable processed = new DefaultMessageSourceResolvable(new String[] { "complete" },
            new String[] { filename }, " Your data has been processed!");
    String msrQmessage = ctx.getMessage(processed, Locale.FRANCE);
    System.out.println(msrQmessage);

}

From source file:technology.tikal.customers.model.contact.ContactOfyFactory.java

public static ContactOfy build(CustomerOfy parent, Contact source) {
    if (source == null) {
        return null;
    }//  w  w w . ja v a  2 s  .  c o  m
    ContactOfy nuevo;
    if (source instanceof PrimaryContact) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "IllegalBuild.ContactOfyFactory.build.PrimaryContact" },
                new String[] { PrimaryContact.class.getSimpleName() }, "Can't create PrimaryContact objects"));
    }
    if (source instanceof Associate) {
        Associate associateData = (Associate) source;
        nuevo = new AssociateOfy(parent, associateData);
    } else {
        nuevo = new ContactOfy(parent, source);
    }
    return nuevo;
}

From source file:com.github.pjungermann.config.errors.KeysWithoutSpecificationError.java

@NotNull
@Override//from   www.  j av  a  2  s .c  o  m
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code }, new Object[] { keys }, code);
}

From source file:com.github.pjungermann.config.specification.constraint.NoSuchConstraintError.java

@NotNull
@Override//ww  w.  j ava  2s.  com
public MessageSourceResolvable getMessage() {
    return new DefaultMessageSourceResolvable(new String[] { MESSAGE_CODE },
            new Object[] { name, key, sourceLine }, MESSAGE_CODE);
}

From source file:com.github.pjungermann.config.specification.types.TypeConversionFailedError.java

@NotNull
@Override/*from w  w w  .  jav  a2s .c  om*/
public MessageSourceResolvable getMessage() {
    return new DefaultMessageSourceResolvable(new String[] { MESSAGE_CODE },
            new Object[] { key, value, type, cause }, MESSAGE_CODE);
}

From source file:com.github.pjungermann.config.specification.types.TypeConversionConfigError.java

@NotNull
@Override/* w ww. java2s  .c om*/
public MessageSourceResolvable getMessage() {
    return new DefaultMessageSourceResolvable(new String[] { MESSAGE_CODE },
            new Object[] { key, sourceLine, config }, MESSAGE_CODE);
}

From source file:com.github.pjungermann.config.specification.constraint.range.RangeTypeMismatchError.java

@NotNull
@Override//from   w ww.  j  a  v a2  s.c om
public MessageSourceResolvable getMessage() {
    final SourceLine sourceLine = constraint.definedAt();

    return new DefaultMessageSourceResolvable(new String[] { MESSAGE_CODE },
            new Object[] { sourceLine, constraint.getKey(), value,
                    value == null ? "<null>" : value.getClass().getName(), expectation,
                    expectation.getFrom().getClass().getName() },
            MESSAGE_CODE);
}

From source file:technology.tikal.ventas.controller.producto.imp.ProductoControllerImp.java

@Override
public Producto crear(Long idCatalogo, Producto request) {
    CatalogoOfy catalogo = (CatalogoOfy) catalogoController.cargar(idCatalogo);
    if (request.getId() != null) {
        throw new MessageSourceResolvableException(new DefaultMessageSourceResolvable(
                new String[] { "NoValidRequest.ProductoControllerImp.crear" },
                new String[] { request.getId() + "" }, "El producto no debe tener id en la creacion"));
    }/*w ww  .jav  a2s. co  m*/
    ProductoOfy nuevo = ProductoFactory.create(catalogo, request);
    nuevo.update(request);
    dao.guardar(catalogo, nuevo);
    return nuevo;
}

From source file:com.github.pjungermann.config.specification.constraint.multi.UnsupportedCollectionEntryPropertyError.java

/**
 * The error message to be rendered.//  w  w  w  . ja  v  a2s  .  c  o  m
 *
 * @return the error message to be rendered.
 */
@NotNull
@Override
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code },
            new Object[] { key.key, key.collectionKey, entry }, code);
}

From source file:com.github.pjungermann.config.specification.constraint.multi.PropertyFieldAccessFailedError.java

/**
 * The error message to be rendered.//from  ww w .ja  v a  2 s .co  m
 *
 * @return the error message to be rendered.
 */
@NotNull
@Override
public MessageSourceResolvable getMessage() {
    final String code = getMessageCode();

    return new DefaultMessageSourceResolvable(new String[] { code },
            new Object[] { key.key, key.collectionKey, entry, fieldName }, code);
}