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 
    ConstructorDescription
    URLAdapter()
    Constructs a new URLAdapter, with no additional properties.
    URLAdapter​(java.net.URL base)
    Constructs a new URLAdapter, configured to use relative URLs using the supplied URL as a base.
  • Method Summary

    Modifier and TypeMethodDescription
    java.net.URLgetBaseURL()
    Gets the base URL used by this URLAdapter instance.
    java.lang.Stringmarshal​(java.net.URL v) 
    java.net.URLunmarshal​(java.lang.String v) 

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • URLAdapter

      public URLAdapter()
      Constructs a new URLAdapter, 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 new URLAdapter, 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 class javax.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 class javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,​java.net.URL>
    • getBaseURL

      public java.net.URL getBaseURL()
      Gets the base URL used by this URLAdapter instance.
      Returns:
      The base URL used, or null if this instance has not been configured for relative URLs