Record Class NamingConventions

java.lang.Object
java.lang.Record
com.pragma.archetype.domain.model.structure.NamingConventions

public record NamingConventions(Map<String,String> suffixes, Map<String,String> prefixes) extends Record
Naming conventions for components in an architecture. Defines suffixes and prefixes to apply to component names.
  • Constructor Details

    • NamingConventions

      public NamingConventions(Map<String,String> suffixes, Map<String,String> prefixes)
      Creates an instance of a NamingConventions record class.
      Parameters:
      suffixes - the value for the suffixes record component
      prefixes - the value for the prefixes record component
  • Method Details

    • applyConventions

      public String applyConventions(String componentType, String baseName)
      Applies naming conventions to a component name.
      Parameters:
      componentType - The type of component (e.g., "useCase", "port", "adapter")
      baseName - The base name without conventions
      Returns:
      The name with conventions applied
    • getSuffix

      public String getSuffix(String componentType)
      Gets the suffix for a component type.
      Parameters:
      componentType - The component type
      Returns:
      The suffix, or empty string if not defined
    • getPrefix

      public String getPrefix(String componentType)
      Gets the prefix for a component type.
      Parameters:
      componentType - The component type
      Returns:
      The prefix, or empty string if not defined
    • hasConventionsFor

      public boolean hasConventionsFor(String componentType)
      Checks if conventions are defined for a component type.
    • 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.
    • suffixes

      public Map<String,String> suffixes()
      Returns the value of the suffixes record component.
      Returns:
      the value of the suffixes record component
    • prefixes

      public Map<String,String> prefixes()
      Returns the value of the prefixes record component.
      Returns:
      the value of the prefixes record component