Package org.joggito.core.descriptors

Examples of org.joggito.core.descriptors.PropertyDescriptor


  @Test
  public void creatingPropertyDescriptors() throws Exception {
    // FOR firstName property...
    Field fFirstName = Person.class.getDeclaredField("firstName");
    PropertyDescriptor fnProp = factory.createProperty(fFirstName);

    // test...
    assertEquals(FOAF.firstName, fnProp.getRDFObject());
    assertEquals("firstName", fnProp.getName());

    // ---------------------------------------------------------------

    // FOR family_name property...
    Field fFamilyName = Person.class.getDeclaredField("familyName");
    PropertyDescriptor fmnProp = factory.createProperty(fFamilyName);

    // test...
    assertEquals(FOAF.family_name, fmnProp.getRDFObject());
    assertEquals("family_name", fmnProp.getName());

    // ---------------------------------------------------------------

    // FOR mbox property...
    Field fMBox = Person.class.getDeclaredField("mboxSHA1");
    PropertyDescriptor mBoxProp = factory.createProperty(fMBox);

    // test...
    assertEquals(FOAF.mbox_sha1sum, mBoxProp.getRDFObject());
    assertEquals("mbox_sha1sum", mBoxProp.getName());

    // ---------------------------------------------------------------

    // FOR birthday property...
    Field fBirthday = Person.class.getDeclaredField("birthday");
    PropertyDescriptor birthdayProp = factory.createProperty(fBirthday);

    // test...
    assertEquals(FOAF.birthday, birthdayProp.getRDFObject());
    assertEquals("birthday", birthdayProp.getName());
    assertEquals("EEE MMM dd HH:mm:ss zzz yyyy", birthdayProp.getDatePattern());

    // ---------------------------------------------------------------

    // FOR phone property...
    Field fPhones = Person.class.getDeclaredField("phones");
    PropertyDescriptor phonesProp = factory.createProperty(fPhones);

    // test...
    assertEquals(FOAF.phone, phonesProp.getRDFObject());
    assertEquals("phone", phonesProp.getName());
    assertEquals(1, phonesProp.getMinCardinality());
    assertEquals(5, phonesProp.getMaxCardinality());
  }
View Full Code Here

TOP

Related Classes of org.joggito.core.descriptors.PropertyDescriptor

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.