Package com.inspiresoftware.lib.dto.geda.assembler.extension

Examples of com.inspiresoftware.lib.dto.geda.assembler.extension.DataWriter


                dtoClass, meta.getDtoFieldName(), dtoPropertyDescriptors);

        final MethodSynthesizer synthesizer = context.getMethodSynthesizer();

        final DataReader dtoFieldRead = meta.isReadOnly() ? null : synthesizer.synthesizeReader(dtoFieldDesc);
        final DataWriter dtoFieldWrite = synthesizer.synthesizeWriter(dtoFieldDesc);


        final boolean isMapEntity = Map.class.isAssignableFrom(entityClass);
        final boolean isListEntity = !isMapEntity && List.class.isAssignableFrom(entityClass);

        final MethodSynthesizer entitySynthesizer;
        final PropertyDescriptor entityFieldDesc;

        if (isMapEntity || isListEntity) {
            if (isMapEntity) {
                entitySynthesizer = mapSynthesizer;
            } else {
                entitySynthesizer = listSynthesizer;
            }
            entityFieldDesc = dtoFieldDesc;
        } else {
            entitySynthesizer = synthesizer;
            entityFieldDesc = PropertyInspector.getEntityPropertyDescriptorForField(
            dtoClass, entityClass, meta.getDtoFieldName(), meta.getEntityFieldName(), entityPropertyDescriptors);
        }

    final DataReader entityFieldRead = entitySynthesizer.synthesizeReader(entityFieldDesc);
    final DataWriter entityFieldWrite = meta.isReadOnly() ? null : entitySynthesizer.synthesizeWriter(entityFieldDesc);

        return new MapPipe(context,
                dtoFieldRead, dtoFieldWrite,
                entityFieldRead, entityFieldWrite,
                meta);
View Full Code Here


            entityFieldDesc = PropertyInspector.getEntityPropertyDescriptorForField(
            dtoClass, entityClass, meta.getDtoFieldName(), meta.getEntityFieldName(), entityPropertyDescriptors);
        }
   
    final DataReader entityFieldRead = entitySynthesizer.synthesizeReader(entityFieldDesc);
    final DataWriter entityFieldWrite = meta.isReadOnly() ? null : entitySynthesizer.synthesizeWriter(entityFieldDesc);
   
    return new DataPipeChain(
                meta.isReadOnly() ? null : synthesizer.synthesizeReader(dtoFieldDesc),
                entityFieldRead,
                entityFieldWrite, pipe, meta);
View Full Code Here

  public void testSynthesizeWriterOnClass() throws GeDAException {
   
    final TestDto1Class dto = new TestDto1Class();
    dto.setMyString("Hello");
   
    final DataWriter writerMyString = new SunJavaToolsMethodSynthesizer(this.getClass().getClassLoader(), WORKING_DIRECTORY).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Class.class, "myString",
            PropertyInspector.getPropertyDescriptorsForClass(TestDto1Class.class)   
        )   
    );
   
    assertEquals(String.class, writerMyString.getParameterType());
    writerMyString.write(dto, "Goodbye");
    assertEquals("Goodbye", dto.getMyString());
   
  }
View Full Code Here

  public void testSynthesizeWriterOnInterface() throws GeDAException {
   
    final TestDto1Interface dto = new TestDto1Class();
    dto.setMyString("Hello");
   
    final DataWriter writerMyString = new SunJavaToolsMethodSynthesizer(this.getClass().getClassLoader(), WORKING_DIRECTORY).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "myString",
            PropertyInspector.getPropertyDescriptorsForClass(TestDto1Interface.class)   
        )   
    );
   
    assertEquals(String.class, writerMyString.getParameterType());
    writerMyString.write(dto, "Goodbye");
    assertEquals("Goodbye", dto.getMyString());
   
  }
View Full Code Here

  @Test
  public void testWriterOnIfaceClo() throws GeDAException {
   
    final TestSynthesizerByInterface dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "loo",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByInterface.class)   
        )   
    );
   
    assertEquals(Long.class, writer.getParameterType());
    writer.write(dto, LO_4);
    assertEquals(LO_4, dto.getLoo());
   
  }
View Full Code Here

  @Test
  public void testWriterOnClassPdb() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "db",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Double.class, writer.getParameterType());
    writer.write(dto, DD_4);
    assertEquals(DD_4, dto.getDb(), 0);
   
  }
View Full Code Here

  @Test
  public void testWriterOnIfacePdb() throws GeDAException {
   
    final TestSynthesizerByInterface dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "db",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByInterface.class)   
        )   
    );
   
    assertEquals(Double.class, writer.getParameterType());
    writer.write(dto, DD_4);
    assertEquals(DD_4, dto.getDb(), 0);
   
  }
View Full Code Here

  @Test
  public void testWriterOnClassCdb() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "dbo",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Double.class, writer.getParameterType());
    writer.write(dto, DO_4);
    assertEquals(DO_4, dto.getDbo(), 0);
   
  }
View Full Code Here

  @Test
  public void testWriterOnIfaceCdb() throws GeDAException {
   
    final TestSynthesizerByInterface dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "dbo",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByInterface.class)   
        )   
    );
   
    assertEquals(Double.class, writer.getParameterType());
    writer.write(dto, DO_4);
    assertEquals(DO_4, dto.getDbo());
   
  }
View Full Code Here

  @Test
  public void testWriterOnClassCob() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
   
    final DataWriter writer = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeWriter(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "ob",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Object.class, writer.getParameterType());
    writer.write(dto, OBJ);
    assertEquals(OBJ, dto.getOb());
   
  }
View Full Code Here

TOP

Related Classes of com.inspiresoftware.lib.dto.geda.assembler.extension.DataWriter

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.