Package com.inspiresoftware.lib.dto.geda.examples.usecases

Examples of com.inspiresoftware.lib.dto.geda.examples.usecases.SimpleMapExtensibleBeanFactory


     * Example of how an entity class can be aliased through key and interface.
     */
    public void byClassWithAlias() {


        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerDto("myDto", MyDtoClass.class.getCanonicalName());
        bf.registerDto("myDtoField3Dto", MyDtoField3Class.class.getCanonicalName());
        bf.registerEntity("myEntityField3Entity", MyEntityField3Class.class.getCanonicalName(), MyEntityField3Class.class.getCanonicalName());
        bf.registerDto("field4ParentDto", MyDtoField4Class.class.getCanonicalName());
        bf.registerEntity("field4ParentEntity", MyEntityField4Class.class.getCanonicalName(), MyEntityField4Class.class.getCanonicalName());
        bf.registerEntity("field2", MyEntityField2Class.class.getCanonicalName(), MyEntityField2Class.class.getCanonicalName());

        registry
                // main mapping
                .dto("myDto").forEntity(MyEntityClass.class).alias("myEntity", MyEntity.class)
                // field 1
View Full Code Here


    /**
     * Example of how DTO by key can be mapped to a specific entity interface.
     */
    public void byInterface() {

        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerDto("myDto", MyDtoClass.class.getCanonicalName());
        bf.registerEntity("myEntity", MyEntityClass.class.getCanonicalName(), MyEntity.class.getCanonicalName());
        bf.registerDto("myDtoField3Dto", MyDtoField3Class.class.getCanonicalName());
        bf.registerEntity("myEntityField3Entity", MyEntityField3Class.class.getCanonicalName(), MyEntityField3Class.class.getCanonicalName());
        bf.registerDto("field4ParentDto", MyDtoField4Class.class.getCanonicalName());
        bf.registerEntity("field4ParentEntity", MyEntityField4Class.class.getCanonicalName(), MyEntityField4Class.class.getCanonicalName());
        bf.registerEntity("field2", MyEntityField2Class.class.getCanonicalName(), MyEntityField2Class.class.getCanonicalName());

        registry
                // main mapping
                .dto("myDto").forEntity(MyEntity.class)
                // field 1
View Full Code Here

     * Example of most common use case for mapping to generic entity (i.e. full runtime discovery).
     */
    public void generic() {


        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerDto("myDto", MyDtoClass.class.getCanonicalName());
        bf.registerEntity("myEntity", MyEntityClass.class.getCanonicalName(), MyEntity.class.getCanonicalName());
        bf.registerDto("myDtoField3Dto", MyDtoField3Class.class.getCanonicalName());
        bf.registerEntity("myEntityField3Entity", MyEntityField3Class.class.getCanonicalName(), MyEntityField3Class.class.getCanonicalName());
        bf.registerDto("field4ParentDto", MyDtoField4Class.class.getCanonicalName());
        bf.registerEntity("field4ParentEntity", MyEntityField4Class.class.getCanonicalName(), MyEntityField4Class.class.getCanonicalName());
        bf.registerEntity("field2", MyEntityField2Class.class.getCanonicalName(), MyEntityField2Class.class.getCanonicalName());

        registry
                // main mapping
                .dto("myDto").forEntityGeneric()
                // field 1
View Full Code Here

     * Example of how mapping from one DTO-Entity context can be copied to
     * another DTO-Entity context to reduce code duplication.
     */
    public void reuseMapping() {

        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerDto("myDto", MyDtoClass.class.getCanonicalName());
        bf.registerDto("myDtoField3Dto", MyDtoField3Class.class.getCanonicalName());
        bf.registerEntity("myEntityField3Entity", MyEntityField3Class.class.getCanonicalName(), MyEntityField3Class.class.getCanonicalName());
        bf.registerDto("field4ParentDto", MyDtoField4Class.class.getCanonicalName());
        bf.registerEntity("field4ParentEntity", MyEntityField4Class.class.getCanonicalName(), MyEntityField4Class.class.getCanonicalName());

        registry
                // main mapping
                .dto("myDto").forEntity(MyEntity.class)
                // field 1
View Full Code Here

     * the beanKey approach, for others just use the appropriate class instead
     * of beanKey.
     */
    public void withSameFieldsByKey() {

        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerEntity("myEntityWithSameFields",
                MyEntityWithSameFieldsClass.class.getCanonicalName(),
                MyEntityWithSameFieldsInterface.class.getCanonicalName());

        registry
                // main mapping
View Full Code Here

     * Example showing how to use exclusions with auto mapping of same name same type fields.
     * The basic principle is the same - all you need is to specify the exclusion field names.
     */
    public void withSameFieldsByKeyExcluding() {

        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerEntity("myEntityWithSameFields",
                MyEntityWithSameFieldsClass.class.getCanonicalName(),
                MyEntityWithSameFieldsInterface.class.getCanonicalName());

        registry
                // main mapping
View Full Code Here

     * Example of how to use DSL where all references to DTO and Entity is via a string
     * key, which is resolved through extensible bean factory.
     */
    public void byReference() {

        final ExtensibleBeanFactory bf = new SimpleMapExtensibleBeanFactory();

        final com.inspiresoftware.lib.dto.geda.dsl.Registry registry = Registries.registry(bf);

        bf.registerDto("myDto", MyDtoClass.class.getCanonicalName());
        bf.registerEntity("myEntity", MyEntityClass.class.getCanonicalName(), MyEntity.class.getCanonicalName());
        bf.registerDto("myDtoField3Dto", MyDtoField3Class.class.getCanonicalName());
        bf.registerEntity("myEntityField3Entity", MyEntityField3Class.class.getCanonicalName(), MyEntityField3Class.class.getCanonicalName());
        bf.registerDto("field4ParentDto", MyDtoField4Class.class.getCanonicalName());
        bf.registerEntity("field4ParentEntity", MyEntityField4Class.class.getCanonicalName(), MyEntityField4Class.class.getCanonicalName());
        bf.registerEntity("field2", MyEntityField2Class.class.getCanonicalName(), MyEntityField2Class.class.getCanonicalName());

        registry
                // main mapping
                .dto("myDto").forEntity("myEntity")
                // field 1
View Full Code Here

TOP

Related Classes of com.inspiresoftware.lib.dto.geda.examples.usecases.SimpleMapExtensibleBeanFactory

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.