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

com.cedarsoft.commons.javafx.EnumTranslatorUtil Maven / Gradle / Ivy

There is a newer version: 8.9.2
Show newest version
package com.cedarsoft.commons.javafx;

import java.util.concurrent.atomic.AtomicReference;

import javax.annotation.Nonnull;

/**
 * @author Christian Erbelding ([email protected])
 */
public class EnumTranslatorUtil {
  /**
   * Holds the reference to the currently active translator that is set in a static field
   */
  @Nonnull
  private static final AtomicReference ENUM_TRANSLATOR = new AtomicReference<>(item -> {
    System.err.println("No enum translator set in com.cedarsoft.commons.javafx.EnumListCell");
    return item.name();
  });

  private EnumTranslatorUtil() {
    // utility class
  }

  @Nonnull
  public static EnumTranslator getEnumTranslator() {
    return ENUM_TRANSLATOR.get();
  }

  public static void setEnumTranslator(@Nonnull EnumTranslator enumTranslator) {
    ENUM_TRANSLATOR.set(enumTranslator);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy