The formatting of the incoming parameters of the 1.web access layer and the parameter formatting of the outgoing data of the Web return value should be unified.
Like in Acspace,
The incoming layer parameter @requestbody the JavaBean object. Unified conversion to JavaBean incoming parameters.
Returns a value that returns the Resultobject object uniformly, Resultobject implements serialization. And the Resultobject defines which properties are transferred back,
3.ResultObject, defined public outgoing parameter properties
Public classResultobject implements Serializable {/** * */ Private StaticFinalLongSerialversionuid =-2523760680706423997L; PrivateString Res_info =""; PrivateObject data =""; Private intresult = $; //TODO Paging Object PublicResultobject (String res_info) { This. Res_info =Res_info; } Publicresultobject (Object data) { This. data =data; } PublicResultobject (ResultCode resultcode) { This. Res_info =Resultcode.getname (); This. result =Resultcode.getindex (); } @SuppressWarnings ("unchecked") Public<t extends Resultobject>T configerrmsg (ResultCode err) { This. Setresult (Err.getindex ()); This. Setres_info (Err.getname ()); returnT This; } PublicResultobject () {} PublicString Getres_info () {returnRes_info; } Public voidSetres_info (String res_info) { This. Res_info =Res_info; } PublicObject GetData () {returndata; } Public voidsetData (Object data) { This. data =data; } Public intGetResult () {returnresult; } Public voidSetresult (intresult) { This. result =result; }}
3. Returns a Resultobject object that defines multiple constructors.
Used to pass in different types and return them. Yes
Resultobject (String res_info)
Resultobject (ResultCode ResultCode)
Resultobject (Object data)
Private StaticFinalLongSerialversionuid =-2523760680706423997L; PrivateString Res_info =""; PrivateObject data =""; Private intresult = $; //TODO Paging Object PublicResultobject (String res_info) { This. Res_info =Res_info; } Publicresultobject (Object data) { This. data =data; } PublicResultobject (ResultCode resultcode) { This. Res_info =Resultcode.getname (); This. result =Resultcode.getindex (); } @SuppressWarnings ("unchecked") Public<t extends Resultobject>T configerrmsg (ResultCode err) { This. Setresult (Err.getindex ()); This. Setres_info (Err.getname ()); returnT This; }
The formatting of incoming parameters of Web Access layer and the parameter formatting of the Web return value outgoing data, all must be unified