Not all service technology can the same. You can avoid problems with this hints.
public class Customer { private String name = null; private List cars = null; public Customer() { } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public List getCars() { return this.cars; } public void setCars(List cars) { this.cars = cars; } }
public interface Calculator { // FALSE int add(int a, int b); long add(long a, long b); // make two different method names int addInt(int a, int b); long addLong(long a, long b); }
public interface Echo { // false String ping(); // right String echo(String echoString); }
public class ValidationError implements Serializable { private static final long serialVersionUID = 5930253049442253128L; private int code = 0; private String message = "No message available!"; public ValidationError() { } public ValidationError(int pvCode, String pvMessage) { setCode(pvCode); setMessage(pvMessage); } public void setCode(int pvCode) { code = pvCode; } public int getCode() { return code; } public void setMessage(String pvMessage) { message = pvMessage; } public String getMessage() { return message; } public String toString() { return code + " - " + message; } } // and the Exception as container for the ValidationError public class MyBusinessException extends RuntimeException { private static final long serialVersionUID = 3669006021606741955L; private List validationErrors = new ArrayList(); public MyBusinessException() {} public MyBusinessException(String pvMessage) { super(pvMessage); } public List getValidationErrors() { return validationErrors; } public void setValidationErrors(List pvValidationErrors) { validationErrors = pvValidationErrors; } } // and the business method signature example public interface BusinessService { public Object businessServiceMethod(Object arg) throws MyBusinessException; }