Package org.bifrost.xmlio.config

Examples of org.bifrost.xmlio.config.Converter


      }
    }
   
   
    // We've got the type, figure out what converter to use
    Converter converter = pmap.getConverter();
    if (converter == null)
      converter = config.getConverter(paramClassName);
//    else
//    {
//      if (!pmap.getPropertyType().equals(paramClassName))
//      {
//        pmap.setPropertyType(paramClass);
//        converter = config.getConverter(paramClassName);
//        pmap.setConverter(converter);
//      }
//    }

    // If no converter is found, make sure we are not processing a text
    // node, we must be processing a subtag (an object).
    if (converter == null)
    {
      if (value instanceof java.lang.String)
      {
        logger.info("Warning, processing text but no converter found for "
            + paramClassName);
        return;
      }
    }

    // Found a setter so now lets make sure the attribute value is of the
    // correct type and then call the setter.
    Object[] params = null;
    if (value != null && paramClassName != null)
    { 
      params = new Object[1];
//      Converter converter = config.getConverter(paramClass);
      if (converter == null)
      {
        params[0] = value;
      }
      else
      {
        Object converterImpl = null;
       
        if (converter.getClass().getName().equals(converter.getClassname()))
          converterImpl = converter;
        else
        {
          ObjectFactory factory = config.getObjectFactory();
          converterImpl = factory.getInstance(converter.getClassname());
        }
        try
        {
          Class[] convTypes = new Class[1];
          convTypes[0] = value.getClass();
          Method parseMethod =
            converterImpl.getClass().getMethod(converter.getParseMethod(),
                convTypes);
          Object[] convParams = new Object[1];
          convParams[0] = value;
          params[0] = parseMethod.invoke(converterImpl, convParams);
        }
        catch(NoSuchMethodException nsme)
        {
          logger.info("No such method " + converter.getParseMethod());
        }
        catch (InvocationTargetException ite)
        {
          logger.info("Called method threw an exception.");
        }
View Full Code Here


      throw new XmlException(EX_NULL_ATTRIBUTE);

    String name = pmap.getPropertyXmlName();
   
    // Look up the alias for this attribute name and use it, if it exists
    Converter converter = null;
    if (pmap.getPropertyXmlName() != null)
      name = pmap.getPropertyXmlName();
    converter = pmap.getConverter();
   
    if (converter == null)
View Full Code Here

TOP

Related Classes of org.bifrost.xmlio.config.Converter

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.