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

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


  public void testSynthesizeReaderOnInterface() throws GeDAException {
   
    final TestDto1Interface dto = new TestDto1Class();
    dto.setMyString("Hello");
   
    final DataReader readerMyString = new SunJavaToolsMethodSynthesizer(this.getClass().getClassLoader(), WORKING_DIRECTORY).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "myString",
            PropertyInspector.getPropertyDescriptorsForClass(TestDto1Interface.class)   
        )   
    );
   
    assertEquals("Hello", readerMyString.read(dto));
    assertEquals(String.class, readerMyString.getReturnType());
   
  }
View Full Code Here


  @Test
  public void testSynthesizeReaderOnCollectionReturnType() throws GeDAException {
   
    final TestDto12CollectionClass dto = new TestDto12CollectionClass();
   
    final DataReader readerMyString = new SunJavaToolsMethodSynthesizer(this.getClass().getClassLoader(), WORKING_DIRECTORY).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto12CollectionClass.class, "items",
            PropertyInspector.getPropertyDescriptorsForClass(TestDto12CollectionClass.class)   
        )   
    );
   
    assertNull(readerMyString.read(dto));
    assertEquals(Collection.class, readerMyString.getReturnType());
   
  }
View Full Code Here

            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 DataPipeChain(
                meta.isReadOnly() ? null : synthesizer.synthesizeReader(dtoFieldDesc),
                entityFieldRead,
View Full Code Here

  @Test
  public void testSynthesizeReaderOnMapReturnType() throws GeDAException {
   
    final TestDto12MapToMapClass dto = new TestDto12MapToMapClass();
   
    final DataReader readerMyString = new SunJavaToolsMethodSynthesizer(this.getClass().getClassLoader(), WORKING_DIRECTORY).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto12MapToMapClass.class, "items",
            PropertyInspector.getPropertyDescriptorsForClass(TestDto12MapToMapClass.class)   
        )   
    );
   
    assertNull(readerMyString.read(dto));
    assertEquals(Map.class, readerMyString.getReturnType());
   
  }
View Full Code Here

      CtMethod methodGetReturnType = CtMethod.make(getReturnTypeMethodCode.toString(), ctClass);
      ctClass.addMethod(methodGetReturnType);
      ctClass.detach();
     
      final DataReader reader = (DataReader) ctClass.toClass(
          loader, DataReader.class.getProtectionDomain()).newInstance();
     
      return reader;
     
    } catch (CannotCompileException cce) {
View Full Code Here

  public void testReaderOnClassPbool() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
    dto.setBool(BB_T);
   
    final DataReader reader = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "bool",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Boolean.class, reader.getReturnType());
    assertEquals(BO_T, reader.read(dto));
   
  }
View Full Code Here

  public void testReaderOnIfacePbool() throws GeDAException {
   
    final TestSynthesizerByInterface dto = new TestSynthesizerByClass();
    dto.setBool(BB_T);
   
    final DataReader reader = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "bool",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByInterface.class)   
        )   
    );
   
    assertEquals(Boolean.class, reader.getReturnType());
    assertEquals(BO_T, reader.read(dto));
   
  }
View Full Code Here

  public void testReaderOnClassCbool() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
    dto.setBoolo(BO_T);
   
    final DataReader reader = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "boolo",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Boolean.class, reader.getReturnType());
    assertEquals(BO_T, reader.read(dto));
   
  }
View Full Code Here

  public void testReaderOnIfaceCbool() throws GeDAException {
   
    final TestSynthesizerByInterface dto = new TestSynthesizerByClass();
    dto.setBoolo(BO_T);
   
    final DataReader reader = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "boolo",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByInterface.class)   
        )   
    );
   
    assertEquals(Boolean.class, reader.getReturnType());
    assertEquals(BO_T, reader.read(dto));
   
  }
View Full Code Here

  public void testReaderOnClassPby() throws GeDAException {
   
    final TestSynthesizerByClass dto = new TestSynthesizerByClass();
    dto.setBy(YY_1);
   
    final DataReader reader = new MethodSynthesizerProxy(this.getClass().getClassLoader(), this.synthesizer).synthesizeReader(
        PropertyInspector.getDtoPropertyDescriptorForField(
            TestDto1Interface.class, "by",
            PropertyInspector.getPropertyDescriptorsForClass(TestSynthesizerByClass.class)   
        )   
    );
   
    assertEquals(Byte.class, reader.getReturnType());
    assertEquals(YO_1, reader.read(dto));
   
  }
View Full Code Here

TOP

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

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.