
package de.ivu.elect.jee.entity.customdata;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CustomDataSerializerFactory {

  private static final Logger LOG = LoggerFactory.getLogger(CustomDataSerializerFactory.class);

  private static final CustomDataSerializer customDataSerializer;

  static {
    CustomDataSerializer tmp;
    try {
      tmp = (CustomDataSerializer) Class.forName("de.ivu.elect.jee.entity.customdata.XStreamCustomDataSerializer")
          .getDeclaredConstructor()
          .newInstance();
      LOG.info("XStream present");
    } catch (Exception e) {
      // ignore
      LOG.info("XStream NOT present");
      tmp = new NoopCustomDataSerializer();
    }
    customDataSerializer = tmp;
  }

  public static CustomDataSerializer getCustomDataSerializer() {
    return customDataSerializer;
  }

}
