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 018 package org.apache.commons.proxy.util; 019 020 import java.io.IOException; 021 import java.io.Serializable; 022 023 /** 024 * @author James Carman 025 * @since 1.0 026 */ 027 public class EchoImpl extends AbstractEcho implements DuplicateEcho, Serializable 028 { 029 private static final long serialVersionUID = -4844873352607521103L; 030 031 public boolean echoBack( boolean b ) 032 { 033 return b; 034 } 035 036 public String echoBack( String message1, String message2 ) 037 { 038 return message1 + message2; 039 } 040 041 public String echoBack( String[] messages ) 042 { 043 final StringBuffer sb = new StringBuffer(); 044 for( int i = 0; i < messages.length; i++ ) 045 { 046 String message = messages[i]; 047 sb.append( message ); 048 } 049 return sb.toString(); 050 } 051 052 public int echoBack( int i ) 053 { 054 return i; 055 } 056 057 public void echo() 058 { 059 } 060 061 public void ioException() throws IOException 062 { 063 throw new IOException( "dummy message" ); 064 } 065 066 public void illegalArgument() 067 { 068 throw new IllegalArgumentException( "dummy message" ); 069 } 070 }