// Path: src/main/java/org/jacis/plugin/readonly/DefaultJacisStoreEntryReadOnlyModeAdapter.java
// public class DefaultJacisStoreEntryReadOnlyModeAdapter<V> implements JacisStoreEntryReadOnlyModeAdapter<V> {
// 
//   @Override
//   public boolean isApplicableTo(V value) {
//     return value instanceof JacisReadonlyModeSupport;
//   }
// 
//   @Override
//   public boolean isReadOnly(V value) {
//     return ((JacisReadonlyModeSupport) value).isReadOnly();
//   }
// 
//   @Override
//   public V switchToReadOnlyMode(V value) {
//     ((JacisReadonlyModeSupport) value).switchToReadOnlyMode();
//     return value;
//   }
// 
//   @Override
//   public V switchToReadWriteMode(V value) {
//     ((JacisReadonlyModeSupport) value).switchToReadWriteMode();
//     return value;
//   }
// 
//   @Override
//   public String toString() {
//     return getClass().getSimpleName();
//   }
// }
// 
// Path: src/main/java/org/jacis/plugin/readonly/JacisStoreEntryReadOnlyModeAdapter.java
// @JacisApi
// public interface JacisStoreEntryReadOnlyModeAdapter<V> {
// 
//   /**
//    * Returns if this adapter can switch the read / write mode for the passed object
//    *
//    * @param value The object to check.
//    * @return if this adapter can switch the read / write mode for the passed object
//    */
//   boolean isApplicableTo(V value);
// 
//   /**
//    * Returns if the passed object is in read-only mode
//    *
//    * @param value The object to check.
//    * @return if the passed object is in read-only mode
//    */
//   boolean isReadOnly(V value);
// 
//   /**
//    * Switch the read / write mode for the passed object to read-only mode
//    * Note that the calling methods will work with the returned value.
//    * Therefore the implementation of the method may return another instance than the passed (e.g. a proxy).
//    *
//    * @param value The object to switch to read-only mode
//    * @return the object with the switched mode.
//    */
//   V switchToReadOnlyMode(V value);
// 
//   /**
//    * Switch the read / write mode for the passed object to read-write mode
//    * Note that the calling methods will work with the returned value.
//    * Therefore the implementation of the method may return another instance than the passed (e.g. a proxy).
//    *
//    * @param value The object to switch to read-write mode
//    * @return the object with the switched mode.
//    */
//   V switchToReadWriteMode(V value);
// 
// }


import org.jacis.plugin.readonly.JacisStoreEntryReadOnlyModeAdapter;
import org.jacis.JacisApi;
import org.jacis.plugin.readonly.DefaultJacisStoreEntryReadOnlyModeAdapter;

/*
 * Copyright (c) 2016. Jan Wiemer
 */

package org.jacis.plugin.objectadapter.cloning;


/**
 * Implementation of the {@link AbstractJacisCloningObjectAdapter} cloning the objects based on the Java clone method.
 * The behavior is similar to the {@link JacisCloningObjectAdapter} but returning a read only version of the object does not first check if the object supports a read only mode.
 *
 * @param <V> The object type (note that in this case the committed values and the values in the transactional view have the same type)
 * @author Jan Wiemer
 */
@JacisApi
public class JacisCloningObjectAdapterUnsafe<V> extends JacisCloningObjectAdapter<V> {

  /**
   * Create a cloning object adapter with the passed read only mode adapter.
   * 
   * @param readOnlyModeAdapters Adapter to switch an object between read-only and read-write mode (if supported).
   */
  public JacisCloningObjectAdapterUnsafe(JacisStoreEntryReadOnlyModeAdapter<V> readOnlyModeAdapters) {
    super(readOnlyModeAdapters);
    if (readOnlyModeAdapters == null) {
      throw new IllegalArgumentException(this.getClass().getName() + " can only be initialized with a read onbly mode adapter!");
    }
  }

  /**
   * Create a cloning object adapter with a default read only mode adapter (see {@link DefaultJacisStoreEntryReadOnlyModeAdapter}).
   */
  public JacisCloningObjectAdapterUnsafe() {
    super();
  }

  @Override
  public V cloneCommitted2ReadOnlyTxView(V value) {

// Path: src/main/java/org/jacis/plugin/readonly/DefaultJacisStoreEntryReadOnlyModeAdapter.java
// public class DefaultJacisStoreEntryReadOnlyModeAdapter<V> implements JacisStoreEntryReadOnlyModeAdapter<V> {
// 
//   @Override
//   public boolean isApplicableTo(V value) {
//     return value instanceof JacisReadonlyModeSupport;
//   }
// 
//   @Override
//   public boolean isReadOnly(V value) {
//     return ((JacisReadonlyModeSupport) value).isReadOnly();
//   }
// 
//   @Override
//   public V switchToReadOnlyMode(V value) {
//     ((JacisReadonlyModeSupport) value).switchToReadOnlyMode();
//     return value;
//   }
// 
//   @Override
//   public V switchToReadWriteMode(V value) {
//     ((JacisReadonlyModeSupport) value).switchToReadWriteMode();
//     return value;
//   }
// 
//   @Override
//   public String toString() {
//     return getClass().getSimpleName();
//   }
// }
// 
// Path: src/main/java/org/jacis/plugin/readonly/JacisStoreEntryReadOnlyModeAdapter.java
// @JacisApi
// public interface JacisStoreEntryReadOnlyModeAdapter<V> {
// 
//   /**
//    * Returns if this adapter can switch the read / write mode for the passed object
//    *
//    * @param value The object to check.
//    * @return if this adapter can switch the read / write mode for the passed object
//    */
//   boolean isApplicableTo(V value);
// 
//   /**
//    * Returns if the passed object is in read-only mode
//    *
//    * @param value The object to check.
//    * @return if the passed object is in read-only mode
//    */
//   boolean isReadOnly(V value);
// 
//   /**
//    * Switch the read / write mode for the passed object to read-only mode
//    * Note that the calling methods will work with the returned value.
//    * Therefore the implementation of the method may return another instance than the passed (e.g. a proxy).
//    *
//    * @param value The object to switch to read-only mode
//    * @return the object with the switched mode.
//    */
//   V switchToReadOnlyMode(V value);
// 
//   /**
//    * Switch the read / write mode for the passed object to read-write mode
//    * Note that the calling methods will work with the returned value.
//    * Therefore the implementation of the method may return another instance than the passed (e.g. a proxy).
//    *
//    * @param value The object to switch to read-write mode
//    * @return the object with the switched mode.
//    */
//   V switchToReadWriteMode(V value);
// 
// }


// Path: src/main/java/org/jacis/plugin/objectadapter/cloning/JacisCloningObjectAdapterUnsafe.java
import org.jacis.plugin.readonly.JacisStoreEntryReadOnlyModeAdapter;
import org.jacis.JacisApi;
import org.jacis.plugin.readonly.DefaultJacisStoreEntryReadOnlyModeAdapter;

/*
 * Copyright (c) 2016. Jan Wiemer
 */

package org.jacis.plugin.objectadapter.cloning;


/**
 * Implementation of the {@link AbstractJacisCloningObjectAdapter} cloning the objects based on the Java clone method.
 * The behavior is similar to the {@link JacisCloningObjectAdapter} but returning a read only version of the object does not first check if the object supports a read only mode.
 *
 * @param <V> The object type (note that in this case the committed values and the values in the transactional view have the same type)
 * @author Jan Wiemer
 */
@JacisApi
public class JacisCloningObjectAdapterUnsafe<V> extends JacisCloningObjectAdapter<V> {

  /**
   * Create a cloning object adapter with the passed read only mode adapter.
   * 
   * @param readOnlyModeAdapters Adapter to switch an object between read-only and read-write mode (if supported).
   */
  public JacisCloningObjectAdapterUnsafe(JacisStoreEntryReadOnlyModeAdapter<V> readOnlyModeAdapters) {
    super(readOnlyModeAdapters);
    if (readOnlyModeAdapters == null) {
      throw new IllegalArgumentException(this.getClass().getName() + " can only be initialized with a read onbly mode adapter!");
    }
  }

  /**
   * Create a cloning object adapter with a default read only mode adapter (see {@link DefaultJacisStoreEntryReadOnlyModeAdapter}).
   */
  public JacisCloningObjectAdapterUnsafe() {
    super();
  }

  @Override
  public V cloneCommitted2ReadOnlyTxView(V value) {

    return value;
