001/*
002 *  Copyright 2013 Chris Pheby
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.jadira.reflection.cloning.api;
017
018
019/**
020 * A Cloner represents the capability for Cloning. Its the interface via which users of the library
021 * in general will interact with it. 
022 */
023public interface Cloner {
024
025        /**
026         * Clones the supplied object
027         * @param obj The object
028         * @param <T> The class of the object to be cloned
029         * @return A clone of the object
030         */
031        <T> T clone(T obj);
032
033        /**
034         * This method is included simply so that cold starts can be avoided. The method performs any
035         * initialisation needed in order to be able to subsequently process the class. If it is not
036         * called ahead of time the initialisation will be performed as part of the cloning operation.
037         * You only need to use this method in situations where a cold start is unacceptable
038         * @param classes Classes to perform initialisation for.
039         */
040        public void initialiseFor(Class<?> classes);
041}