Desarrolle componentes de servicio para proporcionar lógica reutilizable a varias aplicaciones en el servidor.
public interface CustomerInfo { public Customer getCustomerInfo(String customerID); }
public class CustomerInfoImpl implements CustomerInfo { public Customer getCustomerInfo(String customerID) { Customer cust = new Customer(); cust.setCustNo(customerID); cust.setFirstName("Victor"); cust.setLastName("Hugo"); cust.setSymbol("IBM"); cust.setNumShares(100); cust.setPostalCode(10589); cust.setErrorMsg(""); return cust; } }
public interface StockQuote { public float getQuote(String symbol); }
public class StockQuoteImpl implements StockQuote { public float getQuote(String symbol) { return 100.0f; } }
public interface StockQuoteAsync { // respuesta diferida public Ticket getQuoteAsync(String symbol); public float getQuoteResponse(Ticket ticket, long timeout); // devolución de llamada public Ticket getQuoteAsync(String symbol, StockQuoteCallback callback); }
public interface StockQuoteCallback { public void onGetQuoteResponse(Ticket ticket, float quote); }
(c) Copyright IBM Corporation 2005, 2006.
Este centro de información está basado en tecnología Eclipse (http://www.eclipse.org)