I want define service as web service.
I define a method with register
name. Its a class as input parameter with RegisterParam
name and a return type with RegisterResult
name as output.
public class RegisterParam{
String name;
String family;
}
public class RegisterResult{
Integer registr_id;
}
public interface Service{
public RegisterResult register(RegistrParam param);
}
If register service failed and its logic not doing so I have two solution for notify to service caller:
In RegisterResult class add a property as
result_code
and a enumeration for its value. If its value is zero means register sercice successfully done and if its value is else of zero means register service failed andresult_code
shows reason of fail.register service throws a exception when it is falied and if dont any exception throwed means register service done successfully.
My question is: what above solution is bettr and why?