Package org.htmlparser.beans
Class LinkBean
- java.lang.Object
-
- org.htmlparser.beans.LinkBean
-
- All Implemented Interfaces:
java.io.Serializable
public class LinkBean extends java.lang.Object implements java.io.Serializable
Extract links from a URL.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.URL[]
mLinks
The strings extracted from the URL.protected Parser
mParser
The parser used to extract strings.protected java.beans.PropertyChangeSupport
mPropertySupport
Bound property support.static java.lang.String
PROP_LINKS_PROPERTY
Property name in event where the URL contents changes.static java.lang.String
PROP_URL_PROPERTY
Property name in event where the URL changes.
-
Constructor Summary
Constructors Constructor Description LinkBean()
Creates new LinkBean
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.protected boolean
equivalent(java.net.URL[] array1, java.net.URL[] array2)
Determine if two arrays of URL's are the same.protected java.net.URL[]
extractLinks()
Internal routine to extract all the links from the parser.java.net.URLConnection
getConnection()
Getter for property Connection.java.net.URL[]
getLinks()
Getter for property links.java.lang.String
getURL()
Getter for property URL.static void
main(java.lang.String[] args)
Unit test.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.void
setConnection(java.net.URLConnection connection)
Setter for property Connection.void
setURL(java.lang.String url)
Setter for property URL.
-
-
-
Field Detail
-
PROP_LINKS_PROPERTY
public static final java.lang.String PROP_LINKS_PROPERTY
Property name in event where the URL contents changes.- See Also:
- Constant Field Values
-
PROP_URL_PROPERTY
public static final java.lang.String PROP_URL_PROPERTY
Property name in event where the URL changes.- See Also:
- Constant Field Values
-
mPropertySupport
protected java.beans.PropertyChangeSupport mPropertySupport
Bound property support.
-
mLinks
protected java.net.URL[] mLinks
The strings extracted from the URL.
-
mParser
protected Parser mParser
The parser used to extract strings.
-
-
Method Detail
-
extractLinks
protected java.net.URL[] extractLinks() throws ParserException
Internal routine to extract all the links from the parser.- Returns:
- A list of all links on the page as URLs.
- Throws:
ParserException
- If the parse fails.
-
equivalent
protected boolean equivalent(java.net.URL[] array1, java.net.URL[] array2)
Determine if two arrays of URL's are the same.- Parameters:
array1
- One array of URL'sarray2
- Another array of URL's- Returns:
true
if the URL's match in number and value,false
otherwise.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Parameters:
listener
- The PropertyChangeListener to be added.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a registered PropertyChangeListener.- Parameters:
listener
- The PropertyChangeListener to be removed.
-
getLinks
public java.net.URL[] getLinks()
Getter for property links.- Returns:
- Value of property links.
-
getURL
public java.lang.String getURL()
Getter for property URL.- Returns:
- Value of property URL.
-
setURL
public void setURL(java.lang.String url)
Setter for property URL.- Parameters:
url
- New value of property URL.
-
getConnection
public java.net.URLConnection getConnection()
Getter for property Connection.- Returns:
- Value of property Connection.
-
setConnection
public void setConnection(java.net.URLConnection connection)
Setter for property Connection.- Parameters:
connection
- New value of property Connection.
-
main
public static void main(java.lang.String[] args)
Unit test.- Parameters:
args
- Pass arg[0] as the URL to process.
-
-