Record Class WPSiteInfo

java.lang.Object
java.lang.Record
net.ygbstudio.powerwp4j.models.entities.WPSiteInfo
Record Components:
fullyQualifiedDomainName - the fully qualified domain name of the WordPress site
wpUser - the username for the WordPress site
wpAppPass - the application password for the WordPress site

public record WPSiteInfo(String fullyQualifiedDomainName, String wpUser, String wpAppPass) extends Record
A record that represents basic site information required to interact with a WordPress site.
  • Constructor Details

    • WPSiteInfo

      public WPSiteInfo(String fullyQualifiedDomainName, String wpUser, String wpAppPass)
      Creates an instance of a WPSiteInfo record class.
      Parameters:
      fullyQualifiedDomainName - the value for the fullyQualifiedDomainName record component
      wpUser - the value for the wpUser record component
      wpAppPass - the value for the wpAppPass record component
  • Method Details

    • apiBaseUrl

      @Contract(pure=true) @NotNull public @NotNull String apiBaseUrl()
      Returns the base URL of the WordPress REST API.
      Returns:
      the base URL of the WordPress REST API
    • fromConfigResource

      public static Optional<WPSiteInfo> fromConfigResource(String fileName)
      Returns an Optional of WPSiteInfo loaded from the specified configuration resource properties file.
      Parameters:
      fileName - the name of the resource file to load properties from
      Returns:
      an Optional of WPSiteInfo loaded from the specified configuration resource file
    • fromEnv

      public static Optional<WPSiteInfo> fromEnv()
      Returns a WPSiteInfo loaded from the environment variables outlined in EnvironmentScope.
      Returns:
      a WPSiteInfo loaded from the environment variables
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • fullyQualifiedDomainName

      public String fullyQualifiedDomainName()
      Returns the value of the fullyQualifiedDomainName record component.
      Returns:
      the value of the fullyQualifiedDomainName record component
    • wpUser

      public String wpUser()
      Returns the value of the wpUser record component.
      Returns:
      the value of the wpUser record component
    • wpAppPass

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