net.spy.info
Class Info

java.lang.Object
  extended bynet.spy.SpyObject
      extended bynet.spy.info.Info
Direct Known Subclasses:
BigWords, eBay, FlightTracker, PackageInfo, Traffic, Weather

public abstract class Info
extends SpyObject

net.spy.info.* superclass -- extend this to provide info services


Field Summary
protected  String arg
           
protected  boolean error
           
protected  Hashtable hinfo
           
protected  String info
           
 
Constructor Summary
Info()
          Get an info object.
 
Method Summary
 String deEntity(String in)
          Remove HTML entity stuff from a String.
 String get(String what)
          Get a value out of the info hash.
 String get(String what, String def)
          Same as the above, but allows a default to use when the variable does not exist.
protected abstract  void getInfo()
          getInfo gets the data to be parsed.
 boolean goodInfo()
          returns true if the information is good
protected abstract  void parseInfo()
          parseInfo parses the data into the hinfo Hashtable object.
 void setArg(String arg)
          Set the arguments, useful when it was called with a constructor with no args.
 String toString()
          Get a string representation of the info object.
 String toXML()
          Get an XML representation of the info object as a String.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

error

protected boolean error

info

protected String info

hinfo

protected Hashtable hinfo

arg

protected String arg
Constructor Detail

Info

public Info()
Get an info object.

Method Detail

setArg

public void setArg(String arg)
Set the arguments, useful when it was called with a constructor with no args.


toString

public String toString()
Get a string representation of the info object.


toXML

public String toXML()
Get an XML representation of the info object as a String.


goodInfo

public boolean goodInfo()
returns true if the information is good


get

public String get(String what)
           throws Exception
Get a value out of the info hash.

Parameters:
what - which variable to get
Throws:
Exception - will be thrown if the info cannot be parsed

get

public String get(String what,
                  String def)
           throws Exception
Same as the above, but allows a default to use when the variable does not exist.

Parameters:
what - which variable to get
def - default value
Throws:
Exception - will be thrown if the info cannot be parsed

deEntity

public String deEntity(String in)
Remove HTML entity stuff from a String.

Parameters:
in - String that may contain HTML entities.
Returns:
the String with known entities replaced.

getInfo

protected abstract void getInfo()
                         throws Exception
getInfo gets the data to be parsed.

Throws:
Exception

parseInfo

protected abstract void parseInfo()
                           throws Exception
parseInfo parses the data into the hinfo Hashtable object. It will be called when needed.

Throws:
Exception