FileDocCategorySizeDatePackage
StockQuoteTransformer.javaAPI DocExample2513Wed May 18 09:38:58 BST 2005com.discursive.jccook.collections.lazy

StockQuoteTransformer

public class StockQuoteTransformer extends Object implements org.apache.commons.collections.Transformer

Fields Summary
protected URL
quoteURL
protected long
timeout
Constructors Summary
Methods Summary
public java.net.URLgetQuoteURL()

 return quoteURL; 
public longgetTimeout()

 return timeout; 
public voidsetQuoteURL(java.net.URL url)

 quoteURL = url; 
public voidsetTimeout(long l)

 timeout = l; 
public java.lang.Objecttransform(java.lang.Object symbol)

		QuoteRetriever retriever = new QuoteRetriever( (String) symbol );
		
		try {
			Thread retrieveThread = new Thread( retriever );
			retrieveThread.start();
			retrieveThread.join( timeout );
		} catch( InterruptedException ie ) {
			System.out.println( "Quote request timed out.");
		}
		
		return retriever.getResult();