Examples of ObjectMap


Examples of org.bifrost.xmlio.config.ObjectMap

   */
  public void testSimpleAttributes()
  {
    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    ObjectMap oMap =
      ObjectMap.createFromClassAsAttributes(TestHelperSimple.class);
    config.addObjectMap(oMap);

    CharArrayWriter output = new CharArrayWriter();
    assertNotNull(output);
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

   */
  public void testMixedAttributes()
  {
    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    ObjectMap oMap = ObjectMap.createFromClass(TestHelperSimple.class);
    PropertyMap pMap = oMap.getPropertyMapFromName("number");
    pMap.setWriteAsAttribute(true);
    config.addObjectMap(oMap);

    CharArrayWriter output = new CharArrayWriter();
    assertNotNull(output);
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    List list = new LinkedList();
    list.add(new PropertyMap("a", "string"));
    list.add(new PropertyMap("b", "number"));
    ObjectMap oMap = new ObjectMap("obj", "TestHelperSimple", list);
    config.addObjectMap(oMap);
    list = new LinkedList();
    list.add(new PropertyMap("obj", "testHelperSimple"));
    oMap = new ObjectMap("TestHelperComplex", "TestHelperComplex", list);
    config.addObjectMap(oMap);
    // Create the object graph
    TestHelperComplex helper = new TestHelperComplex();
    assertNotNull(helper);
    TestHelperSimple simple = new TestHelperSimple(222l, "aaa");
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

   * the properties of the inner objects are output as XML attributes.
   */
  public void testComplexAttributes()
  {
    XmlIOConfig config = XmlIOConfig.getInstance();
    ObjectMap oMap =
      ObjectMap.createFromClassAsAttributes(TestHelperSimple.class);
    config.addObjectMap(oMap);

    CharArrayWriter output = new CharArrayWriter();
    assertNotNull(output);
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    List list = new LinkedList();
    list.add(new PropertyMap("a", "string"));
    list.add(new PropertyMap("b", "number"));
    ObjectMap oMap = new ObjectMap("obj", "TestHelperSimple", list);
    config.addObjectMap(oMap);
    list = new LinkedList();
    list.add(new PropertyMap("obj", "TestHelperSimple"));
    oMap = new ObjectMap("TestHelperComplex", "TestHelperComplex", list);
    config.addObjectMap(oMap);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

    String configString = createXml(TEST_OBJECT_MAPPING);
    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    List list = new LinkedList();
    list.add(new PropertyMap("obj", "TestHelperSimple"));
    ObjectMap oMap = new ObjectMap("TestHelperComplex", "TestHelperComplex", list);
    config.addObjectMap(oMap);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

    XmlIOConfig config = XmlIOConfig.getInstance();
    // Set up mapping
    List list = new LinkedList();
    list.add(new PropertyMap("a", "string"));
    list.add(new PropertyMap("b", "number"));
    ObjectMap oMap = new ObjectMap("TestHelperSimple", "TestHelperSimple", list);
    config.addObjectMap(oMap);
    InputStream reader = new ByteArrayInputStream(configString.getBytes());
    XmlReader xmlReader = null;
    try
    {
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

    pmap.setConverter(dconv);
    plist.add(pmap);
    pmap = new PropertyMap("endTime");
    pmap.setConverter(dconv);
    plist.add(pmap);
    ObjectMap omap = new ObjectMap("TestHelperDate", "TestHelperDate", plist);
    config.addObjectMap(omap);

    try
    {
      xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

      result = config.getPropertyMapByAlias(xmlName).getPropertyName();

    if (result == null && className != null)
    {
      // See if this object name is mapped
      ObjectMap oMap = config.getObjectMapByName(className);
      if (oMap == null)
      {
        className = StringHelper.capitalizeFirst(className);
        oMap = config.getObjectMapByName(className);
      }
      if (oMap != null && oMap.getPropertyMapFromAlias(xmlName) != null)
        result = oMap.getPropertyMapFromAlias(xmlName).getPropertyName();
    }

    if (result == null)
      result = xmlName;
   
View Full Code Here

Examples of org.bifrost.xmlio.config.ObjectMap

        throw new SAXException(EX_CREATE_OBJECT + objectName + getLocation());
    }

    String methodName = attributeName;

    ObjectMap omap = config.getObjectMapByName(objectName);
    if (omap == null)
      omap = config.getObjectMapByName(nameWithoutPackage(objectName));
    if (omap == null)
    {
      omap = ObjectMap.createFromClass(object.getClass());
      config.addObjectMap(omap);
    }
   
    Method method = null;
    boolean global = false;
   
    PropertyMap pmap = omap.getPropertyMapFromName(methodName);
    if (pmap == null)
      pmap = omap.getPropertyMapFromName(lowerCaseFirst(methodName));
    if (pmap == null)
      pmap = omap.getPropertyMapFromName(capitalizeFirst(methodName));

    // Check to see if it's globally defined
    if (pmap == null)
    {
      pmap = config.getPropertyMapByName(methodName);
      if (pmap == null)
        pmap = config.getPropertyMapByName(lowerCaseFirst(methodName));
      if (pmap == null)
        pmap = config.getPropertyMapByName(capitalizeFirst(methodName));
      if (pmap != null)
        global = true;
    }
   
    StringBuffer trace = new StringBuffer(methodName);
   
    if (pmap == null)
    {
      Object thisObject = instantiateObject(methodName);
      Class superClass = null;
      if (thisObject != null)
        superClass = thisObject.getClass().getSuperclass();

      while (superClass != null && pmap == null)
      {
        methodName = nameWithoutPackage(superClass.getName());
        trace.append(" or ");
        trace.append(methodName);
        pmap = omap.getPropertyMapFromName(methodName);
        if (pmap == null)
          pmap = omap.getPropertyMapFromName(lowerCaseFirst(methodName));

        // Check to see if it's globally defined
        if (pmap == null)
        {
          pmap = config.getPropertyMapByName(methodName);
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.