All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.openservices.ons.api.spi.DefaultInvocationContext Maven / Gradle / Ivy

There is a newer version: 1.9.3.Final
Show newest version
package com.aliyun.openservices.ons.api.spi;

import com.aliyun.openservices.ons.api.Action;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.SendResult;
import com.aliyun.openservices.ons.api.exception.ONSClientException;
import com.aliyun.openservices.ons.api.order.OrderAction;
import com.aliyun.openservices.shade.com.aliyun.openservices.shade.com.google.common.base.Optional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DefaultInvocationContext implements InvocationContext {
    private List messages;

    private SendResult sendResult;

    private ONSClientException exception;

    private Action action;

    private OrderAction orderAction;

    private String consumerGroup;

    private String namespaceId;

    private final Map attributes;

    public DefaultInvocationContext() {
        attributes = new HashMap();
    }

    @Override
    public Optional> getMessages() {
        if (null == messages) {
            return Optional.absent();
        }
        return Optional.of(messages);
    }

    @Override
    public Optional getSendResult() {
        if (null == sendResult) {
            return Optional.absent();
        }
        return Optional.of(sendResult);
    }

    @Override
    public Optional getException() {
        if (null == exception) {
            return Optional.absent();
        }
        return Optional.of(exception);
    }

    @Override
    public Optional getAction() {
        if (null == action) {
            return Optional.absent();
        }
        return Optional.of(action);
    }

    @Override
    public void setAction(Action action) {
        this.action = action;
    }

    @Override
    public Optional getOrderAction() {
        if (null == orderAction) {
            return Optional.absent();
        }
        return Optional.of(orderAction);
    }

    @Override
    public void setOrderAction(OrderAction orderAction) {
        this.orderAction = orderAction;
    }

    @Override
    public Optional getConsumerGroup() {
        if (null == consumerGroup) {
            return Optional.absent();
        }
        return Optional.of(consumerGroup);
    }

    @Override
    public Optional getNamespaceId() {
        if (null == namespaceId) {
            return Optional.absent();
        }
        return Optional.of(namespaceId);
    }

    public void setConsumerGroup(String consumerGroup) {
        this.consumerGroup = consumerGroup;
    }

    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }

    public void setMessages(List messages) {
        this.messages = messages;
    }

    public void setSendResult(SendResult sendResult) {
        this.sendResult = sendResult;
    }

    public void setException(ONSClientException exception) {
        this.exception = exception;
    }

    @Override
    public Map getAttributes() {
        return attributes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy