Record Class RPCGenerationContext.TypeDescriptorField

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.network.rpc.generation.RPCGenerationContext.TypeDescriptorField
Record Components:
name - the name to use for the generated field.
descriptor - the method descriptor to use for field initialization.
Enclosing class:
RPCGenerationContext

private static record RPCGenerationContext.TypeDescriptorField(@NonNull String name, @NonNull String descriptor) extends Record
Information about the request of adding a type descriptor field into the final class. It holds the field name that should be assigned and the method descriptor string the field should be initialized with.
Since:
4.0
  • Field Details

  • Constructor Details

    • TypeDescriptorField

      private TypeDescriptorField(@NonNull @NonNull String name, @NonNull @NonNull String descriptor)
      Creates an instance of a TypeDescriptorField record class.
      Parameters:
      name - the value for the name record component
      descriptor - the value for the descriptor record component
  • Method Details

    • forMethod

      Generates a type descriptor field instance for the given method metadata. This method uses a deterministic way to generate the field name, so each invocation leads to the same field name result.
      Parameters:
      methodMetadata - the method metadata to generate the descriptor info for.
      Returns:
      the generated descriptor field information.
      Throws:
      NullPointerException - if the given method metadata is null.
    • applyToClassAndConstructor

      public void applyToClassAndConstructor(@NonNull @NonNull ClassDesc generatingClass, @NonNull @NonNull ClassBuilder classBuilder, @NonNull @NonNull CodeBuilder constructorCode)
      Adds this field into the target class builder and adds code to the constructor to initialize the field value.
      Parameters:
      generatingClass - the descriptor of the class that is being generated.
      classBuilder - the builder of the class being generated.
      constructorCode - the builder of the constructor code for the current class.
      Throws:
      NullPointerException - if the current class desc, class builder or constructor builder is null.
    • 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.
    • name

      @NonNull public @NonNull String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • descriptor

      @NonNull public @NonNull String descriptor()
      Returns the value of the descriptor record component.
      Returns:
      the value of the descriptor record component