forked from itstamen/rop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.add the rop client sub project ,this is a java client.
2.rop sample add the userRestServiceClient2 to demo the rop client.
- Loading branch information
stamen
committed
Jun 30, 2012
1 parent
b7e3c0d
commit 4e0f020
Showing
16 changed files
with
800 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
rop-client/src/main/java/com/rop/client/CompositeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* 版权声明:中图一购网络科技有限公司 版权所有 违者必究 2012 | ||
* 日 期:12-6-30 | ||
*/ | ||
package com.rop.client; | ||
|
||
import com.rop.RopResponse; | ||
import com.rop.response.ErrorResponse; | ||
|
||
/** | ||
* <pre> | ||
* 客户端的响应,如果{@link #isSuccessful()}返回true,则调用{@link #getErrorResponse()},反之,则应该 | ||
* 调用{@link #getSuccessResponse(Class)} | ||
* </pre> | ||
* | ||
* @author 陈雄华 | ||
* @version 1.0 | ||
*/ | ||
public interface CompositeResponse<T extends RopResponse> { | ||
|
||
/** | ||
* 获取错误的响应对象 | ||
* @return | ||
*/ | ||
ErrorResponse getErrorResponse(); | ||
|
||
/** | ||
* 获取正确的响应对象 | ||
* @param responseClass | ||
* @param <T> | ||
* @return | ||
*/ | ||
T getSuccessResponse(); | ||
|
||
/** | ||
* 响应是否是正确的 | ||
* @return | ||
*/ | ||
boolean isSuccessful(); | ||
} | ||
|
53 changes: 53 additions & 0 deletions
53
rop-client/src/main/java/com/rop/client/DefaultCompositeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* 版权声明:中图一购网络科技有限公司 版权所有 违者必究 2012 | ||
* 日 期:12-6-30 | ||
*/ | ||
package com.rop.client; | ||
|
||
import com.rop.RopResponse; | ||
import com.rop.response.ErrorResponse; | ||
|
||
/** | ||
* <pre> | ||
* 功能说明: | ||
* </pre> | ||
* | ||
* @author 陈雄华 | ||
* @version 1.0 | ||
*/ | ||
public class DefaultCompositeResponse<T extends RopResponse> implements CompositeResponse{ | ||
|
||
private boolean successful; | ||
|
||
private ErrorResponse errorResponse; | ||
|
||
private T successRopResponse; | ||
|
||
public DefaultCompositeResponse(boolean successful) { | ||
this.successful = successful; | ||
} | ||
|
||
@Override | ||
public ErrorResponse getErrorResponse() { | ||
return this.errorResponse; | ||
} | ||
|
||
@Override | ||
public T getSuccessResponse() { | ||
return this.successRopResponse; | ||
} | ||
|
||
public void setErrorResponse(ErrorResponse errorResponse) { | ||
this.errorResponse = errorResponse; | ||
} | ||
|
||
public void setSuccessRopResponse(T successRopResponse) { | ||
this.successRopResponse = successRopResponse; | ||
} | ||
|
||
@Override | ||
public boolean isSuccessful() { | ||
return successful; | ||
} | ||
} | ||
|
Oops, something went wrong.