2016-03-08 89 views
1

我對Java客戶端對象暴露給客戶像更好的辦法來映射Java對象到對象

public abstract class Vehicle{ 
    string id; 
    string name; 
    Enginer engine; 
} 

public class MotorVehicle extends Vehicle { 
    int numOfWheels; 
} 

public class Engine { 
    Rotor rotor; 
    Stator stator; 
    AirGap airgap; 
} 

現在我的業務水平層這是一種相同的結構,但在性質上有所不同。

public abstract class VehicleBusinessModel{ 
    string id; 
    string name; 
} 

public class MotorVehicleBusinessModel extends VehicleBusinessModel { 
    int numOfWheels; 
} 

public class EngineBusinessModel { 
    Rotor rotor; 
    Stator stator; 
    AirGap airgap; 
    Windings windings; 
} 

驗證客戶結構然後轉換爲業務結構的最佳方法是什麼?

謝謝。

回答