Class ConstantHasDisplayText

java.lang.Object
com.helger.commons.text.display.ConstantHasDisplayText
All Implemented Interfaces:
IHasDisplayText

@Immutable @MustImplementEqualsAndHashcode public class ConstantHasDisplayText extends Object implements IHasDisplayText
An implementation of the IHasDisplayText interface that always returns a constant string. Use this only for texts that never need to be translated! Use this class if equals/hashCode is relevant
Author:
Philip Helger
  • Constructor Details

    • ConstantHasDisplayText

      public ConstantHasDisplayText(@Nonnull String sFixedText)
  • Method Details

    • getDisplayText

      @Nullable public String getDisplayText(@Nonnull Locale aContentLocale)
      Specified by:
      getDisplayText in interface IHasDisplayText
      Parameters:
      aContentLocale - The locale to be used for resolving. May not be null.
      Returns:
      The display text of the object in the given locale. May be null if the text could not be resolved in the passed locale.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object