Package com.inspiresoftware.lib.dto.geda.adapter

Examples of com.inspiresoftware.lib.dto.geda.adapter.ValueConverter


     */
    public void withConversion() {
        final DtoClass dto = new DtoClass();
        final EntityClass entity = new EntityClass();
        entity.setDecision(true);
        final ValueConverter conv3toDto = new Converter();
        final Map<String, Object> converters = new HashMap<String, Object>();
        converters.put("boolToEnum", conv3toDto);

        final Assembler assembler =
                DTOAssembler.newAssembler(DtoClass.class, EntityClass.class);
View Full Code Here


                .withField("id")
                .and().withField("subField1")
        ;

        final Map<String, Object> conv = new HashMap<String, Object>();
        conv.put("field1Converter", new ValueConverter() {
            public Object convertToDto(final Object object, final BeanFactory beanFactory) {
                final MyEntity.Field1 field1 = (MyEntity.Field1) object;
                return Boolean.valueOf(field1 == MyEntity.Field1.YES);
            }

            public Object convertToEntity(final Object object, final Object oldEntity, final BeanFactory beanFactory) {
                if ((Boolean) object) {
                    return MyEntity.Field1.YES;
                }
                return MyEntity.Field1.NO;
            }
        });
        conv.put("field5VirtualConverter", new ValueConverter() {
            public Object convertToDto(final Object object, final BeanFactory beanFactory) {
                return String.valueOf(object.hashCode());
            }

            public Object convertToEntity(final Object object, final Object oldEntity, final BeanFactory beanFactory) {
View Full Code Here

TOP

Related Classes of com.inspiresoftware.lib.dto.geda.adapter.ValueConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.