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 Summary
FieldsModifier and TypeFieldDescriptionThe field for thedescriptorrecord component.The field for thenamerecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTypeDescriptorField(@NonNull String name, @NonNull String descriptor) Creates an instance of aTypeDescriptorFieldrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyToClassAndConstructor(@NonNull ClassDesc generatingClass, @NonNull ClassBuilder classBuilder, @NonNull CodeBuilder constructorCode) Adds this field into the target class builder and adds code to the constructor to initialize the field value.Returns the value of thedescriptorrecord component.final booleanIndicates whether some other object is "equal to" this one.forMethod(@NonNull DefaultRPCMethodMetadata methodMetadata) Generates a type descriptor field instance for the given method metadata.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
name
-
descriptor
The field for thedescriptorrecord component.
-
-
Constructor Details
-
TypeDescriptorField
-
-
Method Details
-
forMethod
@NonNull public static @NonNull RPCGenerationContext.TypeDescriptorField forMethod(@NonNull @NonNull DefaultRPCMethodMetadata methodMetadata) 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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
name
-
descriptor
Returns the value of thedescriptorrecord component.- Returns:
- the value of the
descriptorrecord component
-