001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.component.irc;
018    
019    import org.apache.camel.CamelContext;
020    import org.apache.camel.ExchangePattern;
021    import org.apache.camel.impl.DefaultExchange;
022    
023    public class IrcExchange extends DefaultExchange {
024        private IrcBinding binding;
025    
026        public IrcExchange(CamelContext context, ExchangePattern pattern, IrcBinding binding) {
027            super(context, pattern);
028            this.binding = binding;
029        }
030    
031        public IrcExchange(CamelContext context, ExchangePattern pattern, IrcBinding binding, IrcMessage inMessage) {
032            this(context, pattern, binding);
033            setIn(inMessage);
034        }
035    
036        public IrcExchange(DefaultExchange parent, IrcBinding binding) {
037            super(parent);
038            this.binding = binding;
039        }
040    
041        public IrcBinding getBinding() {
042            return binding;
043        }
044    
045        public void setBinding(IrcBinding binding) {
046            this.binding = binding;
047        }
048    
049        @Override
050        public IrcMessage getIn() {
051            return (IrcMessage) super.getIn();
052        }
053    
054        @Override
055        public IrcMessage getOut() {
056            return (IrcMessage) super.getOut();
057        }
058    
059        @Override
060        public IrcMessage getOut(boolean lazyCreate) {
061            return (IrcMessage) super.getOut(lazyCreate);
062        }
063    
064        @Override
065        public IrcMessage getFault() {
066            return (IrcMessage) super.getFault();
067        }
068    
069        @Override
070        public IrcExchange newInstance() {
071            return new IrcExchange(this, getBinding());
072        }
073    
074        @Override
075        protected IrcMessage createInMessage() {
076            return new IrcMessage();
077        }
078    
079        @Override
080        protected IrcMessage createOutMessage() {
081            return new IrcMessage();
082        }
083    }