com.baidu.rigel.biplatform.ma.resource.ResponseResult.java Source code

Java tutorial

Introduction

Here is the source code for com.baidu.rigel.biplatform.ma.resource.ResponseResult.java

Source

/**
 * Copyright (c) 2014 Baidu, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.baidu.rigel.biplatform.ma.resource;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * 
 * Rest Service?rest
 * 
 * @author david.wang
 *
 */
public class ResponseResult implements Serializable {

    /**
     * ??
     */
    public static final int SUCCESS = 0;

    /**
     * ?
     */
    public static final int FAILED = 1;

    /**
     * serialize id
     */
    private static final long serialVersionUID = -4826258907545698916L;

    /**
     * ?????????
     */
    private String statusInfo;

    /**
     * ?0??1?
     */
    private int status;

    /**
     * ???????
     */
    private Object data;

    /**
     * ?
     */
    private Map<String, Serializable> properties = new HashMap<String, Serializable>();

    public String getStatusInfo() {
        return statusInfo;
    }

    public void setStatusInfo(String statusInfo) {
        this.statusInfo = statusInfo;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Map<String, ? extends Serializable> getProperties() {
        return properties;
    }

    public void setProperties(Map<String, Serializable> properties) {
        this.properties = properties;
    }

    /**
     * ?
     * 
     * @param key
     * @param value
     */
    public void addProperty(String key, Serializable value) {
        this.properties.put(key, value);
    }

    /**
     * 
     * {@inheritDoc}
     * 
     */
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}