KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > Transformer


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections;
17
18 /**
19  * Defines a functor interface implemented by classes that transform one
20  * object into another.
21  * <p>
22  * A <code>Transformer</code> converts the input object to the output object.
23  * The input object should be left unchanged.
24  * Transformers are typically used for type conversions, or extracting data
25  * from an object.
26  * <p>
27  * Standard implementations of common transformers are provided by
28  * {@link TransformerUtils}. These include method invokation, returning a constant,
29  * cloning and returning the string value.
30  *
31  * @since Commons Collections 1.0
32  * @version $Revision: 1.10 $ $Date: 2004/04/14 20:08:57 $
33  *
34  * @author James Strachan
35  * @author Stephen Colebourne
36  */

37 public interface Transformer {
38
39     /**
40      * Transforms the input object (leaving it unchanged) into some output object.
41      *
42      * @param input the object to be transformed, should be left unchanged
43      * @return a transformed object
44      * @throws ClassCastException (runtime) if the input is the wrong class
45      * @throws IllegalArgumentException (runtime) if the input is invalid
46      * @throws FunctorException (runtime) if the transform cannot be completed
47      */

48     public Object JavaDoc transform(Object JavaDoc input);
49
50 }
51
Popular Tags