Class URLAdapter

java.lang.Object
jakarta.xml.bind.annotation.adapters.XmlAdapter<String,URL>
de.gurkenlabs.litiengine.util.io.URLAdapter

public class URLAdapter extends jakarta.xml.bind.annotation.adapters.XmlAdapter<String,URL>
This class allows for absolute and relative URLs to be unmarshalled as Java URL objects.
See Also:
  • XmlJavaTypeAdapter
  • 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(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 URL unmarshal(String v) throws MalformedURLException
      Specified by:
      unmarshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<String,URL>
      Throws:
      MalformedURLException
    • marshal

      public String marshal(URL v)
      Specified by:
      marshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<String,URL>
    • getBaseURL

      public 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