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

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

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

import org.infinispan.commons.util.Util;

/**
 * SimpleInstanceAttributeCopier. This {@link AttributeCopier} "copies" an instance by creating a new instance. It does
 * not copy any fields.
 *
 * @author Tristan Tarrant
 * @since 7.2
 */
public class SimpleInstanceAttributeCopier implements AttributeCopier {
   public static final AttributeCopier INSTANCE = new SimpleInstanceAttributeCopier<>();

   private SimpleInstanceAttributeCopier() {
      // Singleton constructor
   }

   @Override
   public T copyAttribute(T attribute) {
      if (attribute == null)
         return null;
      else
         return (T) Util.getInstance(attribute.getClass());
   }

}