Package de.gurkenlabs.litiengine.util.io
Class URLAdapter
java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.net.URL>
de.gurkenlabs.litiengine.util.io.URLAdapter
public class URLAdapter
extends javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.net.URL>
This class allows for absolute and relative URLs to be unmarshalled as Java URL objects.
- See Also:
XmlJavaTypeAdapter
Constructor Summary
Constructors Constructor Description URLAdapter()
Constructs a newURLAdapter
, with no additional properties.URLAdapter(java.net.URL base)
Constructs a newURLAdapter
, configured to use relative URLs using the supplied URL as a base.Method Summary
Modifier and Type Method Description java.net.URL
getBaseURL()
Gets the base URL used by thisURLAdapter
instance.java.lang.String
marshal(java.net.URL v)
java.net.URL
unmarshal(java.lang.String v)
Constructor Details
URLAdapter
public URLAdapter()Constructs a newURLAdapter
, with no additional properties. This constructor is called if no configured instance is available to an unmarshaller.URLAdapter
public URLAdapter(java.net.URL base)Constructs a newURLAdapter
, configured to use relative URLs using the supplied URL as a base.- Parameters:
base
- The base URL to use- See Also:
Unmarshaller.setAdapter(XmlAdapter)
,Marshaller.setAdapter(XmlAdapter)
Method Details
unmarshal
public java.net.URL unmarshal(java.lang.String v) throws java.net.MalformedURLException- Specified by:
unmarshal
in classjavax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.net.URL>
- Throws:
java.net.MalformedURLException
marshal
public java.lang.String marshal(java.net.URL v)- Specified by:
marshal
in classjavax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.net.URL>
getBaseURL
public java.net.URL getBaseURL()Gets the base URL used by thisURLAdapter
instance.- Returns:
- The base URL used, or
null
if this instance has not been configured for relative URLs