All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.commons.configuration.attributes.IdentityAttributeCopier Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.commons.configuration.attributes;

/**
 * IdentityAttributeCopier. This {@link AttributeCopier} does not copy the source attribute, but
 * returns it, so that the same instance can be shared across multiple configurations. Since this
 * can only be safely done with threadsafe objects which store no state, be very careful when using
 * it.
 *
 * @author Tristan Tarrant
 * @since 7.2
 */
public class IdentityAttributeCopier implements AttributeCopier {
   private static final AttributeCopier INSTANCE = new IdentityAttributeCopier<>();

   public static  IdentityAttributeCopier identityCopier() {
      return (IdentityAttributeCopier) INSTANCE;
   }

   @Override
   public T copyAttribute(T attribute) {
      return attribute;
   }
}