gluu
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 関数 | 静的非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxd.common.CommandResponse クラス
org.xdi.oxd.common.CommandResponse の継承関係図
Inheritance graph
org.xdi.oxd.common.CommandResponse 連携図
Collaboration graph

公開メンバ関数

 CommandResponse ()
 
 CommandResponse (ResponseStatus p_status)
 
 CommandResponse (ResponseStatus p_status, JsonNode p_data)
 
ResponseStatus getStatus ()
 
CommandResponse setStatus (ResponseStatus p_status)
 
JsonNode getData ()
 
CommandResponse setData (JsonNode p_data)
 
String toString ()
 

静的公開メンバ関数

static CommandResponse ok ()
 
static CommandResponse error ()
 
static CommandResponse createErrorResponse (ErrorResponse p_error)
 
static CommandResponse createErrorResponse (ErrorResponseCode p_errorCode)
 
static CommandResponse createInternalError ()
 
static CommandResponse createUnsupportedOperationError ()
 

静的公開変数類

static final CommandResponse INTERNAL_ERROR_RESPONSE = CommandResponse.createInternalError()
 
static final String INTERNAL_ERROR_RESPONSE_AS_STRING = createInternalErrorAsString()
 
static final CommandResponse OPERATION_IS_NOT_SUPPORTED = CommandResponse.createUnsupportedOperationError()
 

関数

public< T > T dataAsResponse (Class< T > p_class)
 

静的非公開メンバ関数

static String createInternalErrorAsString ()
 

非公開変数類

ResponseStatus status
 
JsonNode data
 

静的非公開変数類

static final Logger LOG = LoggerFactory.getLogger(CommandResponse.class)
 

詳解

著者
Yuriy Zabrovarnyy
バージョン
0.9, 09/08/2013

構築子と解体子

◆ CommandResponse() [1/3]

org.xdi.oxd.common.CommandResponse.CommandResponse ( )
inline
39  {
40  }

◆ CommandResponse() [2/3]

org.xdi.oxd.common.CommandResponse.CommandResponse ( ResponseStatus  p_status)
inline
42  {
43  status = p_status;
44  }
ResponseStatus status
Definition: CommandResponse.java:34

◆ CommandResponse() [3/3]

org.xdi.oxd.common.CommandResponse.CommandResponse ( ResponseStatus  p_status,
JsonNode  p_data 
)
inline
46  {
47  status = p_status;
48  data = p_data;
49  }
ResponseStatus status
Definition: CommandResponse.java:34
JsonNode data
Definition: CommandResponse.java:37

関数詳解

◆ createErrorResponse() [1/2]

static CommandResponse org.xdi.oxd.common.CommandResponse.createErrorResponse ( ErrorResponse  p_error)
inlinestatic
90  {
91  return CommandResponse.error().setData(new POJONode(p_error));
92  }
CommandResponse()
Definition: CommandResponse.java:39

◆ createErrorResponse() [2/2]

static CommandResponse org.xdi.oxd.common.CommandResponse.createErrorResponse ( ErrorResponseCode  p_errorCode)
inlinestatic
94  {
95  final ErrorResponse error = new ErrorResponse(p_errorCode);
96  error.setErrorDescription(p_errorCode.getDescription());
97  return CommandResponse.error().setData(new POJONode(error));
98  }
static CommandResponse error()
Definition: CommandResponse.java:86
CommandResponse()
Definition: CommandResponse.java:39

◆ createInternalError()

static CommandResponse org.xdi.oxd.common.CommandResponse.createInternalError ( )
inlinestatic
100  {
101  return createErrorResponse(ErrorResponseCode.INTERNAL_ERROR_UNKNOWN);
102  }
static CommandResponse createErrorResponse(ErrorResponse p_error)
Definition: CommandResponse.java:90

◆ createInternalErrorAsString()

static String org.xdi.oxd.common.CommandResponse.createInternalErrorAsString ( )
inlinestaticprivate
108  {
109  final CommandResponse response = CommandResponse.createInternalError();
110  try {
111  return CoreUtils.asJson(response);
112  } catch (IOException e) {
113  LOG.error(e.getMessage(), e);
114  return "";
115  }
116  }
static final Logger LOG
Definition: CommandResponse.java:24
CommandResponse()
Definition: CommandResponse.java:39

◆ createUnsupportedOperationError()

static CommandResponse org.xdi.oxd.common.CommandResponse.createUnsupportedOperationError ( )
inlinestatic
104  {
105  return createErrorResponse(ErrorResponseCode.UNSUPPORTED_OPERATION);
106  }
static CommandResponse createErrorResponse(ErrorResponse p_error)
Definition: CommandResponse.java:90

◆ dataAsResponse()

public<T> T org.xdi.oxd.common.CommandResponse.dataAsResponse ( Class< T >  p_class)
inlinepackage
69  {
70  if (data != null && p_class != null) {
71  final String asString = data.toString();
72  try {
73  return CoreUtils.createJsonMapper().readValue(asString, p_class);
74  } catch (Exception e) {
75  LOG.error(e.getMessage(), e);
76  }
77  LOG.error("Unable to parse string to response, string: {}", asString);
78  }
79  return null;
80  }
static final Logger LOG
Definition: CommandResponse.java:24
JsonNode data
Definition: CommandResponse.java:37

◆ error()

static CommandResponse org.xdi.oxd.common.CommandResponse.error ( )
inlinestatic
86  {
87  return new CommandResponse(ResponseStatus.ERROR);
88  }
CommandResponse()
Definition: CommandResponse.java:39

◆ getData()

JsonNode org.xdi.oxd.common.CommandResponse.getData ( )
inline
60  {
61  return data;
62  }
JsonNode data
Definition: CommandResponse.java:37

◆ getStatus()

ResponseStatus org.xdi.oxd.common.CommandResponse.getStatus ( )
inline
51  {
52  return status;
53  }
ResponseStatus status
Definition: CommandResponse.java:34

◆ ok()

static CommandResponse org.xdi.oxd.common.CommandResponse.ok ( )
inlinestatic
82  {
83  return new CommandResponse(ResponseStatus.OK);
84  }
CommandResponse()
Definition: CommandResponse.java:39

◆ setData()

CommandResponse org.xdi.oxd.common.CommandResponse.setData ( JsonNode  p_data)
inline
64  {
65  data = p_data;
66  return this;
67  }
JsonNode data
Definition: CommandResponse.java:37

◆ setStatus()

CommandResponse org.xdi.oxd.common.CommandResponse.setStatus ( ResponseStatus  p_status)
inline
55  {
56  status = p_status;
57  return this;
58  }
ResponseStatus status
Definition: CommandResponse.java:34

◆ toString()

String org.xdi.oxd.common.CommandResponse.toString ( )
inline

Returns string representation of object

戻り値
string representation of object
124  {
125  final StringBuilder sb = new StringBuilder();
126  sb.append("CommandResponse");
127  sb.append("{status=").append(status);
128  sb.append(", params=").append(data);
129  sb.append('}');
130  return sb.toString();
131  }
ResponseStatus status
Definition: CommandResponse.java:34
JsonNode data
Definition: CommandResponse.java:37

メンバ詳解

◆ data

JsonNode org.xdi.oxd.common.CommandResponse.data
private

◆ INTERNAL_ERROR_RESPONSE

final CommandResponse org.xdi.oxd.common.CommandResponse.INTERNAL_ERROR_RESPONSE = CommandResponse.createInternalError()
static

◆ INTERNAL_ERROR_RESPONSE_AS_STRING

final String org.xdi.oxd.common.CommandResponse.INTERNAL_ERROR_RESPONSE_AS_STRING = createInternalErrorAsString()
static

◆ LOG

final Logger org.xdi.oxd.common.CommandResponse.LOG = LoggerFactory.getLogger(CommandResponse.class)
staticprivate

◆ OPERATION_IS_NOT_SUPPORTED

final CommandResponse org.xdi.oxd.common.CommandResponse.OPERATION_IS_NOT_SUPPORTED = CommandResponse.createUnsupportedOperationError()
static

◆ status

ResponseStatus org.xdi.oxd.common.CommandResponse.status
private

このクラス詳解は次のファイルから抽出されました: