/** * @see javax.xml.bind.Marshaller#setEventHandler(ValidationEventHandler) */ public void setEventHandler(ValidationEventHandler handler) throws JAXBException { if( handler == null ) { eventHandler = new DefaultValidationEventHandler(); } else { eventHandler = handler; } }
static String format( String property, Object arg1 ) { return format( property, new Object[]{arg1} ); }
public ValidationEventLocator getLocation() { return new ValidationEventLocatorImpl(this); } public int getColumnNumber() {
public final Object unmarshal( InputSource source ) throws JAXBException { if( source == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, "source" ) ); } return unmarshal( getXMLReader(), source ); }
public Object unmarshal( Source source ) throws JAXBException { if( source == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, "source" ) ); } if(source instanceof SAXSource) return unmarshal( (SAXSource)source ); if(source instanceof StreamSource) return unmarshal( streamSourceToInputSource((StreamSource)source)); if(source instanceof DOMSource) return unmarshal( ((DOMSource)source).getNode() ); // we don't handle other types of Source throw new IllegalArgumentException(); }
public final void marshal( Object obj, org.xml.sax.ContentHandler handler ) throws JAXBException { checkNotNull( obj, "obj", handler, "handler" ); marshal( obj, new SAXResult(handler) ); }
private Object unmarshal( SAXSource source ) throws JAXBException { XMLReader r = source.getXMLReader(); if( r == null ) r = getXMLReader(); return unmarshal( r, source.getInputSource() ); }
/** * Called when a referenced object doesn't have an ID. */ public void errorMissingId(Object obj) throws SAXException { reportError( new ValidationEventImpl( ValidationEvent.ERROR, Messages.MISSING_ID.format(obj), new ValidationEventLocatorImpl(obj)) ); }
/** * By default, the getNode method is unsupported and throw * an {@link java.lang.UnsupportedOperationException}. * * Implementations that choose to support this method must * override this method. */ public org.w3c.dom.Node getNode( Object obj ) throws JAXBException { checkNotNull( obj, "obj", Boolean.TRUE, "foo" ); throw new UnsupportedOperationException(); }
@Override public UnmarshalException createUnmarshalException( SAXException e ) { return super.createUnmarshalException(e); }
public final void marshal( Object obj, java.io.Writer w ) throws JAXBException { checkNotNull( obj, "obj", w, "writer" ); marshal( obj, new StreamResult(w) ); }
public ValidationEventLocator getLocation() { return new ValidationEventLocatorImpl(locator); }
static String format( String property ) { return format( property, null ); }
static String format( String property, Object arg1, Object arg2 ) { return format( property, new Object[]{arg1,arg2} ); }
static String format( String property, Object arg1, Object arg2, Object arg3 ) { return format( property, new Object[]{arg1,arg2,arg3} ); }
private void checkNotNull( Object o1, String o1Name, Object o2, String o2Name ) { if( o1 == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, o1Name ) ); } if( o2 == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, o2Name ) ); } }
private void checkString( String name, Object value ) throws PropertyException { if(!(value instanceof String)) throw new PropertyException( Messages.format( Messages.MUST_BE_STRING, name ) ); }