Record Class Branding

java.lang.Object
java.lang.Record
io.github.jbastgen.stemma.app.config.Branding
Record Components:
enabled - whether the branding is applied; switched off, it is kept
- the file name of the logo in LOGO_DIR of the configuration folder, or empty

public record Branding(boolean enabled, String primary, String secondary, String tertiary, String name, String street, String city, String country, String web, String email, boolean inTitle, String logo) extends Record
The company branding (feature 16): up to three brand colours, the company name and address, and a logo. The logo is a file in the configuration folder (portable), never a reference to a place outside of it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Branding(boolean enabled, String primary, String secondary, String tertiary, String name, String street, String city, String country, String web, String email, boolean inTitle, String logo)
    Creates an instance of a Branding record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the city record component.
    The company data as lines for the About dialog; empty when the branding is off or has no data.
    Returns the value of the country record component.
    Returns the value of the email record component.
    boolean
    Returns the value of the enabled record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static String
    importLogo(Path source, Path configDir)
    Copies a logo into the configuration folder after checking its type and size.
    boolean
    Returns the value of the inTitle record component.
    Returns the value of the logo record component.
    logoFile(Path configDir)
    The logo file in the configuration folder, if the branding has one and it is there.
    Returns the value of the name record component.
    Returns the value of the primary record component.
    Returns the value of the secondary record component.
    boolean
    showsOnLibrary(Path configDir)
    What the library page shows of the branding: needs the branding to be on and at least a logo, a name or a web address.
    Returns the value of the street record component.
    Returns the value of the tertiary record component.
    final String
    Returns a string representation of this record class.
    web()
    Returns the value of the web record component.
    The company web address as a link that can be opened: https:// is added when there is no scheme; only http and https are accepted.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Branding

      public Branding(boolean enabled, String primary, String secondary, String tertiary, String name, String street, String city, String country, String web, String email, boolean inTitle, String logo)
      Creates an instance of a Branding record class.
      Parameters:
      enabled - the value for the enabled record component
      primary - the value for the primary record component
      secondary - the value for the secondary record component
      tertiary - the value for the tertiary record component
      name - the value for the name record component
      street - the value for the street record component
      city - the value for the city record component
      country - the value for the country record component
      web - the value for the web record component
      email - the value for the email record component
      inTitle - the value for the inTitle record component
      logo - the value for the logo record component
  • Method Details

    • webUrl

      public Optional<String> webUrl()
      The company web address as a link that can be opened: https:// is added when there is no scheme; only http and https are accepted.
    • showsOnLibrary

      public boolean showsOnLibrary(Path configDir)
      What the library page shows of the branding: needs the branding to be on and at least a logo, a name or a web address.
    • companyLines

      public List<String> companyLines()
      The company data as lines for the About dialog; empty when the branding is off or has no data.
    • importLogo

      public static String importLogo(Path source, Path configDir) throws IOException
      Copies a logo into the configuration folder after checking its type and size.
      Returns:
      the file name to store in logo()
      Throws:
      IOException - with a readable message when the file is not usable
    • logoFile

      public Optional<Path> logoFile(Path configDir)
      The logo file in the configuration folder, if the branding has one and it is there.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • enabled

      public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • primary

      public String primary()
      Returns the value of the primary record component.
      Returns:
      the value of the primary record component
    • secondary

      public String secondary()
      Returns the value of the secondary record component.
      Returns:
      the value of the secondary record component
    • tertiary

      public String tertiary()
      Returns the value of the tertiary record component.
      Returns:
      the value of the tertiary record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • street

      public String street()
      Returns the value of the street record component.
      Returns:
      the value of the street record component
    • city

      public String city()
      Returns the value of the city record component.
      Returns:
      the value of the city record component
    • country

      public String country()
      Returns the value of the country record component.
      Returns:
      the value of the country record component
    • web

      public String web()
      Returns the value of the web record component.
      Returns:
      the value of the web record component
    • email

      public String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • inTitle

      public boolean inTitle()
      Returns the value of the inTitle record component.
      Returns:
      the value of the inTitle record component
    • logo

      public String logo()
      Returns the value of the logo record component.
      Returns:
      the value of the logo record component