Class URLEditor

  • All Implemented Interfaces:
    java.beans.PropertyEditor, PropertyEditor<java.net.URL>

    public class URLEditor
    extends PropertyEditorSupport<java.net.URL>
    A property editor for URL.
    • Constructor Detail

      • URLEditor

        public URLEditor()
    • Method Detail

      • setAsText

        public void setAsText​(java.lang.String text)
        Description copied from interface: PropertyEditor
        Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.
        Specified by:
        setAsText in interface java.beans.PropertyEditor
        Specified by:
        setAsText in interface PropertyEditor<java.net.URL>
        Specified by:
        setAsText in class PropertyEditorSupport<java.net.URL>
        Parameters:
        text - The string to be parsed.
      • getAsText

        public java.lang.String getAsText()
        Description copied from interface: PropertyEditor
        Gets the property value as text.
        Specified by:
        getAsText in interface java.beans.PropertyEditor
        Specified by:
        getAsText in interface PropertyEditor<java.net.URL>
        Overrides:
        getAsText in class PropertyEditorSupport<java.net.URL>
        Returns:
        The property value as a human editable string.

        Returns null if the value can't be expressed as an editable string.

        If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().

      • toURL

        public static java.net.URL toURL​(java.lang.String urlspec)
                                  throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • makeURLFromFilespec

        private static java.net.URL makeURLFromFilespec​(java.lang.String filespec)
                                                 throws java.io.IOException
        A helper to make a URL from a filespec.
        Throws:
        java.io.IOException