how to create an interface around classes that already exist but cannot be modified in java
问题 Suppose I already have 2 classes in my code: class SomeOrder { String getOrderId() { return orderId; } } class AnotherOrder { String getOrderId() { return orderId; } } How to create an interface around both these classes which is: interface Order { String getOrderId(); } Ideally, I would modify the code so that SomOrder implements Order and AnotherOrder implements Order but the catch here is that they belong in a package that I cannot control or edit (i.e. they come from an external jar). My