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.objenesis;
017
018import org.objenesis.ObjenesisBase;
019
020/**
021 * Objenesis implementation using the {@link UnsafeInstantiatorStrategy}. This class provides the
022 * Objenesis API a strategy for using sun.misc.Unsafe as a class construction technique.
023 * You may use this class independently of the cloning framework.
024 */
025public class ObjenesisUnsafe extends ObjenesisBase {
026
027        /**
028         * Default constructor using the {@link UnsafeInstantiatorStrategy}
029         */
030        public ObjenesisUnsafe() {
031                super(new UnsafeInstantiatorStrategy());
032        }
033
034        /**
035         * Instance using the {@link UnsafeInstantiatorStrategy} with or without caching of
036         * {@link org.objenesis.instantiator.ObjectInstantiator}.
037         * @param useCache If {@link org.objenesis.instantiator.ObjectInstantiator}s should be cached
038         */
039        public ObjenesisUnsafe(boolean useCache) {
040                super(new UnsafeInstantiatorStrategy(), useCache);
041        }
042}