Record Class RegistrationData

java.lang.Object
java.lang.Record
org.ek9lang.compiler.symbols.RegistrationData
Record Components:
implementationSymbol - The concrete component/service symbol (from call)
interfaceSymbol - The abstract component symbol (from identifierReference), null for services
aspectSymbols - Aspect symbols from aspect declaration (empty if no aspects)
sourceToken - Location of the register statement for error reporting

public record RegistrationData(ISymbol implementationSymbol, ISymbol interfaceSymbol, List<ISymbol> aspectSymbols, IToken sourceToken) extends Record
Holds the data from a 'register' statement within an application block. Two forms exist:
  • Component registration: register ConcreteComp() as AbstractComp
  • Service registration: register ServiceType()
For component registrations both implementation and interface symbols are present. For service registrations only the implementation symbol is present (interface is null). Aspect symbols are populated when with aspect of clause is used.
  • Constructor Details

    • RegistrationData

      public RegistrationData(ISymbol implementationSymbol, ISymbol interfaceSymbol, List<ISymbol> aspectSymbols, IToken sourceToken)
      Creates an instance of a RegistrationData record class.
      Parameters:
      implementationSymbol - the value for the implementationSymbol record component
      interfaceSymbol - the value for the interfaceSymbol record component
      aspectSymbols - the value for the aspectSymbols record component
      sourceToken - the value for the sourceToken record component
  • Method Details

    • isComponentRegistration

      public boolean isComponentRegistration()
      Check if this is a component registration (has an interface mapping).
    • isServiceRegistration

      public boolean isServiceRegistration()
      Check if this is a service registration (no interface mapping).
    • 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.
    • implementationSymbol

      public ISymbol implementationSymbol()
      Returns the value of the implementationSymbol record component.
      Returns:
      the value of the implementationSymbol record component
    • interfaceSymbol

      public ISymbol interfaceSymbol()
      Returns the value of the interfaceSymbol record component.
      Returns:
      the value of the interfaceSymbol record component
    • aspectSymbols

      public List<ISymbol> aspectSymbols()
      Returns the value of the aspectSymbols record component.
      Returns:
      the value of the aspectSymbols record component
    • sourceToken

      public IToken sourceToken()
      Returns the value of the sourceToken record component.
      Returns:
      the value of the sourceToken record component