Ejemplo n.º 1
0
  public Object unmarshal(Object arg0, IUnmarshallingContext arg1) throws JiBXException {

    // make sure we're at the appropriate start tag
    UnmarshallingContext ctx = (UnmarshallingContext) arg1;
    if (!ctx.isAt(m_uri, m_name)) {
      ctx.throwStartTagNameError(m_uri, m_name);
    }

    ctx.parseToStartTag(m_uri, m_name);

    String type = ctx.attributeText(m_uri, TYPE);
    ctx.parsePastStartTag(m_uri, m_name);

    String text = ctx.parseContentText();

    ctx.parsePastEndTag(m_uri, m_name);

    Object obj = null;
    if (type.equals(FLOAT)) obj = new Float((String) text);
    else if (type.equals(COLOR)) obj = colorConverter.fromString(text);
    else if (type.equals(VECTOR)) obj = vectorConverter.fromString(text);
    else if (type.equals(POINT)) obj = pointConverter.fromString(text);

    return obj;
  }