我想问一下,如果您有任何想法,可以使我的Java项目的架构更清晰。
abstract class rdfDataChecker {
List<T> data;
// all abstract methods to check data... more than 20 methods. They all use the list "data".
}
// the idea of this interface is, that all the data loaders can just use feedable.feed(List<T>). (we inject this dataChecker to the data Loader).
interface Feedable {
void feed(List<T>);
}
//implementations in different java frameworks.
class specificRdfDataChecker extends rdfDataChecker implements Feedable{
// implement all the methods.
}
class DataLoader {
private Feedable feedable;
public DataLoader(Feedable feedable) {
this.feedable = feedable;
}
}
提前感谢您的建议。
答案 0 :(得分:1)
这种模式是一种常见且可接受的模式 - 甚至可以在Java库中使用。见extends
implements
ArrayList和Exception ignored in: <bound method Connection.__del__ of <aiomysql.connection.Connection object at 0x00000030F8080B38>>
Traceback (most recent call last):
File "C:\software\development\python3.5\lib\site-packages\aiomysql\connection.py", line 689, in __del__
File "C:\software\development\python3.5\lib\site-packages\aiomysql\connection.py", line 261, in close
File "C:\software\development\python3.5\lib\asyncio\selector_events.py", line 569, in close
File "C:\software\development\python3.5\lib\asyncio\base_events.py", line 447, in call_soon
File "C:\software\development\python3.5\lib\asyncio\base_events.py", line 456, in _call_soon
File "C:\software\development\python3.5\lib\asyncio\base_events.py", line 284, in _check_closed
RuntimeError: Event loop is closed
AbstractList {/ 3}}。
答案 1 :(得分:1)
您可以尝试以下操作: