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

org.apache.cxf.message.AbstractWrappedMessage Maven / Gradle / Ivy

There is a newer version: 0.10.0
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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 org.apache.cxf.message;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

import org.apache.cxf.interceptor.InterceptorChain;
import org.apache.cxf.transport.Destination;

/**
 * A base class to build your own message implementations on.
 */
public abstract class AbstractWrappedMessage implements Message {
    
    private Message message;

    protected AbstractWrappedMessage(Message msg) {
        this.message = msg;
    }

    public void clear() {
        message.clear();
    }

    public boolean containsKey(Object key) {
        return message.containsKey(key);
    }

    public boolean containsValue(Object value) {
        return message.containsValue(value);
    }

    public Set> entrySet() {
        return message.entrySet();
    }

    public boolean equals(Object o) {
        return message.equals(o);
    }

    public Object get(Object key) {
        return message.get(key);
    }

    public Collection getAttachments() {
        return message.getAttachments();
    }

    public void setAttachments(Collection attachments) {
        message.setAttachments(attachments);
    }

    public Message getMessage() {
        return message;
    }

    public void setMessage(Message message) {
        this.message = message;
    }
    
    public Destination getDestination() {
        return message.getDestination();
    }

    public Exchange getExchange() {
        return message.getExchange();
    }

    public final void setExchange(Exchange exchange) {
        message.setExchange(exchange);
    }

    public String getId() {
        return message.getId();
    }

    public void setId(String id) {
        message.setId(id);
    }
    
    public InterceptorChain getInterceptorChain() {
        return message.getInterceptorChain();
    }
    public void setInterceptorChain(InterceptorChain chain) {
        message.setInterceptorChain(chain);
    }

    public  T getContent(Class format) {
        return message.getContent(format);
    }
    public  void removeContent(Class format) {
        message.removeContent(format);
    }

    public Set> getContentFormats() {
        return message.getContentFormats();
    }

    public int hashCode() {
        return message.hashCode();
    }

    public boolean isEmpty() {
        return message.isEmpty();
    }

    public Set keySet() {
        return message.keySet();
    }

    public Object put(String key, Object value) {
        return message.put(key, value);
    }

    public void putAll(Map t) {
        message.putAll(t);
    }

    public Object remove(Object key) {
        return message.remove(key);
    }

    public  void setContent(Class format, Object content) {
        message.setContent(format, content);
    }

    public int size() {
        return message.size();
    }

    public Collection values() {
        return message.values();
    }
    
    public  T get(Class key) {
        return message.get(key);
    }
    public  void put(Class key, T value) {
        message.put(key, value);
    }

    public Object getContextualProperty(String key) {
        return message.getContextualProperty(key);
    }  
    public void setContextualProperty(String key, Object v) {
        if (message instanceof MessageImpl) {
            ((MessageImpl)message).setContextualProperty(key, v);
        }  else if (message instanceof AbstractWrappedMessage) {
            ((AbstractWrappedMessage)message).setContextualProperty(key, v);
        } else {
            //cannot set directly.  Just invalidate the cache.
            message.resetContextCache();
        }        
    }
    
    public Set getContextualPropertyKeys() {
        return message.getContextualPropertyKeys();
    }

    public void resetContextCache() {
        message.resetContextCache();
    }
    
}