On a project I have seen some code which was written by a former employee. The person has named it as an implementation of Adaptor pattern but I am not sure. Here is the code:
public class RowSetAdaptor implements java.io.Serializable {
private javax.sql.rowset.CachedRowSet cachedRowSet;
public RowSetAdaptor() throw SQLException {
cachedRowSet = new com.sun.rowset.CachedRowSetImpl();
}
public void populate(ResultSet resultSet) throw SQLException {
cachedRowSet.populate(resultSet);
}
public boolean next() throw SQLException {
cachedRowSet.next();
}
.... // different methods all using cachedRowSet
}
The way I see it the class RowSetAdaptor is restricting access to CachedRowSet interface as not all methods of CachedRowSet interface are available in RowSetAdaptor class. Is it really an Adaptor pattern? If not then which design pattern is being used here?
TIA
Aucun commentaire:
Enregistrer un commentaire