Java 8 XmlAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 XmlAdapter class.

This code example shows how to use the following methods:marshal
    this.amfClass = amfClass;
  } 
 
  public Object toAMF(Object jaxbObject, AMFMappingContext context) throws AMFMappingException {
    try { 
      return adaptingMapper.toAMF(adapter.marshal(adaptedMapper.toAMF(jaxbObject, context)), context);
    } 
    catch (Exception e) {
      throw new AMFMappingException(e);
    } 
  } 
 
  public Object toJAXB(Object amfObject, AMFMappingContext context) throws AMFMappingException {
    try { 
      return adaptedMapper.toJAXB(adapter.unmarshal(adaptingMapper.toJAXB(amfObject, context)), context);
    } 
    catch (Exception e) {
      throw new AMFMappingException(e);
    } 
  } 
5
CodeRank
This code example shows how to use the following methods:unmarshal
                @SuppressWarnings("rawtypes") 
                XmlAdapter xmlAdapter = typeAdapter.value().newInstance();
                if (marshal) {
                    return xmlAdapter.marshal(obj);
                } else { 
                    return xmlAdapter.unmarshal(obj);
                } 
            } catch (Exception ex) {
                ex.printStackTrace();
            } 
        } 
        return defaultValue; 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:unmarshal
    } 
  } 
 
  public Object toJAXB(Object gwtObject, GWTMappingContext context) throws GWTMappingException {
    try { 
      return adapter.unmarshal(adaptingMapper.toJAXB(gwtObject, context));
    } 
    catch (Exception e) {
      throw new GWTMappingException(e);
    } 
  } 
 
  public Class getJaxbClass() {
    return this.jaxbClass;
  } 
 
  public Class getGwtClass() {
    return this.gwtClass;
  } 
} 
5
CodeRank
This code example shows how to use the following methods:marshal
    @Override 
    public Object convert(Object value) 
    { 
        try { 
            if (_forSerialization) { 
                return _adapter.marshal(value); 
            } 
            return _adapter.unmarshal(value); 
        } catch (RuntimeException e) { 
            throw e; 
        } catch (Exception e) { 
            throw new IllegalArgumentException(e); 
        } 
    } 
 
    @Override 
    public JavaType getInputType(TypeFactory typeFactory) { 
        return _inputType; 
    } 
 
3
CodeRank
See Code Examples for Java 8 XmlAdapter Methods: