View Javadoc

1   /*
2    * Copyright 2004-2005, 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.transform.copiers;
17  
18  import java.util.Locale;
19  
20  import net.sf.morph.transform.DecoratedConverter;
21  import net.sf.morph.transform.DecoratedCopier;
22  import net.sf.morph.transform.TransformationException;
23  import net.sf.morph.transform.transformers.BaseReflectorTransformer;
24  
25  /**
26   * Combines all of the contents of a container into a single container. If any
27   * of the contents of the source container are containers themselves, the
28   * elements are extracted and put into the destination container. Examples:
29   * <ul>
30   * <li>combines an array of Lists into just a single array, with all the
31   * elements from each List copied into the destination array</li>
32   * <li>combines [14, "hello", ["this", "is", "another", "array"], "the", "end"]
33   * (this is a list with 5 elements, a number, a string, an array, and two more
34   * strings) into [14, "hello", "this", "is", "another", "array", "the", "end]
35   * (this list has 8 elements, a number and 7 strings)</li>
36   * </ul>
37   * UNFINISHED 
38   * @author Matt Sgarlata
39   * @since Dec 5, 2004
40   */
41  public class CombiningCopier extends BaseReflectorTransformer implements DecoratedCopier,
42  		DecoratedConverter {
43  
44  	/**
45  	 * Create a new CombiningCopier.
46  	 */
47  	public CombiningCopier() {
48  		super();
49  	}
50  
51  	/**
52  	 * {@inheritDoc}
53  	 */
54  	protected void copyImpl(Object destination, Object source, Locale locale, Integer preferredTransformationType) throws TransformationException {
55  		// TODO Auto-generated method stub
56  		throw new UnsupportedOperationException("not implemented");
57  	}
58  
59  	/**
60  	 * {@inheritDoc}
61  	 */
62  	protected Class[] getSourceClassesImpl() throws Exception {
63  		return getContainerReflector().getReflectableClasses();
64  	}
65  
66  	/**
67  	 * {@inheritDoc}
68  	 */
69  	protected Class[] getDestinationClassesImpl() throws Exception {
70  		// TODO Auto-generated method stub
71  		return null;
72  	}
73  
74  }