Examples of FooBean


Examples of jodd.bean.data.FooBean

public class BeanCopyTest {

  @Test
  public void testCopy() {
    FooBean fb = createFooBean();
    FooBean dest = new FooBean();
    BeanCopy.beans(fb, dest).copy();

    Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertEquals(201, v.intValue());
    v = (Integer) BeanUtil.getProperty(dest, "fooint");
    assertEquals(202, v.intValue());
    Long vl = (Long) BeanUtil.getProperty(dest, "fooLong");
    assertEquals(203, vl.longValue());
    vl = (Long) BeanUtil.getProperty(dest, "foolong");
    assertEquals(204, vl.longValue());
    Byte vb = (Byte) BeanUtil.getProperty(dest, "fooByte");
    assertEquals(95, vb.intValue());
    vb = (Byte) BeanUtil.getProperty(dest, "foobyte");
    assertEquals(96, vb.intValue());
    Character c = (Character) BeanUtil.getProperty(dest, "fooCharacter");
    assertEquals('7', c.charValue());
    c = (Character) BeanUtil.getProperty(dest, "foochar");
    assertEquals('8', c.charValue());
    Boolean b = (Boolean) BeanUtil.getProperty(dest, "fooBoolean");
    assertTrue(b.booleanValue());
    b = (Boolean) BeanUtil.getProperty(dest, "fooboolean");
    assertFalse(b.booleanValue());
    Float f = (Float) BeanUtil.getProperty(dest, "fooFloat");
    assertEquals(209.0, f.floatValue(), 0.005);
    f = (Float) BeanUtil.getProperty(dest, "foofloat");
    assertEquals(210.0, f.floatValue(), 0.005);
    Double d = (Double) BeanUtil.getProperty(dest, "fooDouble");
    assertEquals(211.0, d.doubleValue(), 0.005);
    d = (Double) BeanUtil.getProperty(dest, "foodouble");
    assertEquals(212.0, d.doubleValue(), 0.005);
    String s = (String) BeanUtil.getProperty(dest, "fooString");
    assertEquals("213", s);
    String[] sa = (String[]) BeanUtil.getProperty(dest, "fooStringA");
    assertEquals(2, sa.length);
    assertEquals("214", sa[0]);
    assertEquals("215", sa[1]);
    assertSame(dest.getFooStringA(), sa);


    FooBean empty = new FooBean();
    BeanCopy.beans(empty, dest).copy();

    v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertNull(v);
    v = (Integer) BeanUtil.getProperty(dest, "fooint");
View Full Code Here

Examples of jodd.bean.data.FooBean

    assertNull(sa);
  }

  @Test
  public void testCopyIncludes() {
    FooBean fb = createFooBean();
    FooBean dest = new FooBean();
    BeanCopy.beans(fb, dest).excludeAll().include("fooInteger", "fooLong").copy();

    Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertEquals(201, v.intValue());
    Long vl = (Long) BeanUtil.getProperty(dest, "fooLong");
View Full Code Here

Examples of jodd.bean.data.FooBean

    assertNull(sa);
  }

  @Test
  public void testCopyExcludes() {
    FooBean fb = createFooBean();
    FooBean dest = new FooBean();
    BeanCopy.beans(fb, dest).exclude("fooInteger", "fooLong").copy();

    Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertNull(v);
    v = (Integer) BeanUtil.getProperty(dest, "fooint");
    assertEquals(202, v.intValue());
    Long vl = (Long) BeanUtil.getProperty(dest, "fooLong");
    assertNull(vl);
    vl = (Long) BeanUtil.getProperty(dest, "foolong");
    assertEquals(204, vl.longValue());
    Byte vb = (Byte) BeanUtil.getProperty(dest, "fooByte");
    assertEquals(95, vb.intValue());
    vb = (Byte) BeanUtil.getProperty(dest, "foobyte");
    assertEquals(96, vb.intValue());
    Character c = (Character) BeanUtil.getProperty(dest, "fooCharacter");
    assertEquals('7', c.charValue());
    c = (Character) BeanUtil.getProperty(dest, "foochar");
    assertEquals('8', c.charValue());
    Boolean b = (Boolean) BeanUtil.getProperty(dest, "fooBoolean");
    assertTrue(b.booleanValue());
    b = (Boolean) BeanUtil.getProperty(dest, "fooboolean");
    assertFalse(b.booleanValue());
    Float f = (Float) BeanUtil.getProperty(dest, "fooFloat");
    assertEquals(209.0, f.floatValue(), 0.005);
    f = (Float) BeanUtil.getProperty(dest, "foofloat");
    assertEquals(210.0, f.floatValue(), 0.005);
    Double d = (Double) BeanUtil.getProperty(dest, "fooDouble");
    assertEquals(211.0, d.doubleValue(), 0.005);
    d = (Double) BeanUtil.getProperty(dest, "foodouble");
    assertEquals(212.0, d.doubleValue(), 0.005);
    String s = (String) BeanUtil.getProperty(dest, "fooString");
    assertEquals("213", s);
    String[] sa = (String[]) BeanUtil.getProperty(dest, "fooStringA");
    assertEquals(2, sa.length);
    assertEquals("214", sa[0]);
    assertEquals("215", sa[1]);
    assertSame(dest.getFooStringA(), sa);
  }
View Full Code Here

Examples of jodd.bean.data.FooBean

    assertSame(dest.getFooStringA(), sa);
  }

  @Test
  public void testCopyTemplate() {
    FooBean fooBean = createFooBean();
    FooBean dest = new FooBean();

    BeanCopy.beans(fooBean, dest).includeAs(FooBeanString.class).copy();

    Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertNull(v);
View Full Code Here

Examples of jodd.bean.data.FooBean

  public void testCopyMap() {
    Map map = new HashMap();
    map.put("fooint", Integer.valueOf(102));
    map.put("fooString", "mao");

    FooBean dest = new FooBean();
    BeanCopy.beans(map, dest).copy();
    assertEquals(102, dest.getFooint());
    assertEquals("mao", dest.getFooString());

    Map destMap = new HashMap();
    BeanCopy.beans(map, destMap).copy();
    assertEquals(2, destMap.size());
    assertEquals(Integer.valueOf(102), destMap.get("fooint"));
View Full Code Here

Examples of jodd.bean.data.FooBean

    assertEquals("mao", destMap.get("fooString"));
  }

  @Test
  public void testCopyIgnoreNulls() {
    FooBean fb = createFooBean();
    FooBean dest = new FooBean();

    dest.setFooInteger(Integer.valueOf(999));
    fb.setFooInteger(null);
    BeanCopy.beans(fb, dest).ignoreNulls(true).copy();

    Integer v = (Integer) BeanUtil.getProperty(dest, "fooInteger");
    assertEquals(999, v.intValue());
    v = (Integer) BeanUtil.getProperty(dest, "fooint");
    assertEquals(202, v.intValue());
    Long vl = (Long) BeanUtil.getProperty(dest, "fooLong");
    assertEquals(203, vl.longValue());
    vl = (Long) BeanUtil.getProperty(dest, "foolong");
    assertEquals(204, vl.longValue());
    Byte vb = (Byte) BeanUtil.getProperty(dest, "fooByte");
    assertEquals(95, vb.intValue());
    vb = (Byte) BeanUtil.getProperty(dest, "foobyte");
    assertEquals(96, vb.intValue());
    Character c = (Character) BeanUtil.getProperty(dest, "fooCharacter");
    assertEquals('7', c.charValue());
    c = (Character) BeanUtil.getProperty(dest, "foochar");
    assertEquals('8', c.charValue());
    Boolean b = (Boolean) BeanUtil.getProperty(dest, "fooBoolean");
    assertTrue(b.booleanValue());
    b = (Boolean) BeanUtil.getProperty(dest, "fooboolean");
    assertFalse(b.booleanValue());
    Float f = (Float) BeanUtil.getProperty(dest, "fooFloat");
    assertEquals(209.0, f.floatValue(), 0.005);
    f = (Float) BeanUtil.getProperty(dest, "foofloat");
    assertEquals(210.0, f.floatValue(), 0.005);
    Double d = (Double) BeanUtil.getProperty(dest, "fooDouble");
    assertEquals(211.0, d.doubleValue(), 0.005);
    d = (Double) BeanUtil.getProperty(dest, "foodouble");
    assertEquals(212.0, d.doubleValue(), 0.005);
    String s = (String) BeanUtil.getProperty(dest, "fooString");
    assertEquals("213", s);
    String[] sa = (String[]) BeanUtil.getProperty(dest, "fooStringA");
    assertEquals(2, sa.length);
    assertEquals("214", sa[0]);
    assertEquals("215", sa[1]);
    assertSame(dest.getFooStringA(), sa);
  }
View Full Code Here

Examples of jodd.bean.data.FooBean

    assertEquals("215", sa[1]);
    assertSame(dest.getFooStringA(), sa);
  }

  private FooBean createFooBean() {
    FooBean fb = new FooBean();
    fb.setFooInteger(new Integer(201));
    fb.setFooint(202);
    fb.setFooLong(new Long(203));
    fb.setFoolong(204);
    fb.setFooByte(new Byte((byte) 95));
    fb.setFoobyte((byte) 96);
    fb.setFooCharacter(new Character('7'));
    fb.setFoochar('8');
    fb.setFooBoolean(Boolean.TRUE);
    fb.setFooboolean(false);
    fb.setFooFloat(new Float(209.0));
    fb.setFoofloat((float) 210.0);
    fb.setFooDouble(new Double(211.0));
    fb.setFoodouble(212.0);
    fb.setFooString("213");
    fb.setFooStringA(new String[]{"214", "215"});
    return fb;
  }
View Full Code Here

Examples of net.test.simple.core._06_aop.objs.FooBean

    @Test
    public void customAnnoAopTest() throws IOException, URISyntaxException, InterruptedException {
        System.out.println("--->>customAnnoAopTest<<--");
        AppContext appContext = Hasor.createAppContext(new WarpAnnoAop());
        //
        FooBean fooBean1 = appContext.getInstance(FooBean.class);
        FooBean fooBean2 = appContext.getInstance(CustomAnnoFooBean.class);
        //
        System.out.println("---fooBean1.fooCall()---");
        fooBean1.fooCall();
        System.out.println("---fooBean2.fooCall()---");
        fooBean2.fooCall();
    }
View Full Code Here

Examples of net.test.simple.core._06_aop.objs.FooBean

    @Test
    public void aopTest() throws IOException, URISyntaxException, InterruptedException {
        System.out.println("--->>aopTest<<--");
        AppContext appContext = Hasor.createAppContext(new WarpAop());
        //
        FooBean fooBean = appContext.getInstance(FooBean.class);
        fooBean.fooCall();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.