Record Class GenerationContext
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.network.rpc.generation.GenerationContext
- Record Components:
component- the network component to use when firing the rpc.channelSupplier- the supplier for the network component invoked when firing the rpc.objectMapper- the object mapper mapping the databuf back to an object.dataBufFactory- the databuf factory to use when creating databufs for the generation factory.extendingClass- the class the generated class should extend, null for none.interfaces- the interfaces the generated class should implement.implementAllMethods- if all methods or only abstract methods should get implemented.
public record GenerationContext(@Nullable NetworkComponent component, @Nullable Supplier<NetworkChannel> channelSupplier, @Nullable ObjectMapper objectMapper, @Nullable DataBufFactory dataBufFactory, @Nullable Class<?> extendingClass, @NonNull Set<Class<?>> interfaces, boolean implementAllMethods)
extends Record
A context for the generation of a class which implements some kind of api which only calls methods using rpc.
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a builder for a generation context. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @Nullable Supplier<NetworkChannel>The field for thechannelSupplierrecord component.private final @Nullable NetworkComponentThe field for thecomponentrecord component.private final @Nullable DataBufFactoryThe field for thedataBufFactoryrecord component.The field for theextendingClassrecord component.private final booleanThe field for theimplementAllMethodsrecord component.The field for theinterfacesrecord component.private final @Nullable ObjectMapperThe field for theobjectMapperrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGenerationContext(@Nullable NetworkComponent component, @Nullable Supplier<NetworkChannel> channelSupplier, @Nullable ObjectMapper objectMapper, @Nullable DataBufFactory dataBufFactory, @Nullable Class<?> extendingClass, @NonNull Set<Class<?>> interfaces, boolean implementAllMethods) Creates an instance of aGenerationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder instance for a generation context.Returns the value of thechannelSupplierrecord component.Returns the value of thecomponentrecord component.Returns the value of thedataBufFactoryrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextendingClassrecord component.Creates a new generation context based on the given input class.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theimplementAllMethodsrecord component.Returns the value of theinterfacesrecord component.Returns the value of theobjectMapperrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
component
The field for thecomponentrecord component. -
channelSupplier
The field for thechannelSupplierrecord component. -
objectMapper
The field for theobjectMapperrecord component. -
dataBufFactory
The field for thedataBufFactoryrecord component. -
extendingClass
The field for theextendingClassrecord component. -
interfaces
The field for theinterfacesrecord component. -
implementAllMethods
private final boolean implementAllMethodsThe field for theimplementAllMethodsrecord component.
-
-
Constructor Details
-
GenerationContext
public GenerationContext(@Nullable @Nullable NetworkComponent component, @Nullable @Nullable Supplier<NetworkChannel> channelSupplier, @Nullable @Nullable ObjectMapper objectMapper, @Nullable @Nullable DataBufFactory dataBufFactory, @Nullable @Nullable Class<?> extendingClass, @NonNull @NonNull Set<Class<?>> interfaces, boolean implementAllMethods) Creates an instance of aGenerationContextrecord class.- Parameters:
component- the value for thecomponentrecord componentchannelSupplier- the value for thechannelSupplierrecord componentobjectMapper- the value for theobjectMapperrecord componentdataBufFactory- the value for thedataBufFactoryrecord componentextendingClass- the value for theextendingClassrecord componentinterfaces- the value for theinterfacesrecord componentimplementAllMethods- the value for theimplementAllMethodsrecord component
-
-
Method Details
-
builder
Creates a new builder instance for a generation context.- Returns:
- a new generation context builder.
-
forClass
@NonNull public static @NonNull GenerationContext.Builder forClass(@NonNull @NonNull Class<?> clazz) Creates a new generation context based on the given input class.- Parameters:
clazz- the class to either extend or implement.- Returns:
- a new generation context builder, trying to extend/implement the given class
- Throws:
NullPointerException- if the given class is null.
-
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. -
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. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
component
Returns the value of thecomponentrecord component.- Returns:
- the value of the
componentrecord component
-
channelSupplier
Returns the value of thechannelSupplierrecord component.- Returns:
- the value of the
channelSupplierrecord component
-
objectMapper
Returns the value of theobjectMapperrecord component.- Returns:
- the value of the
objectMapperrecord component
-
dataBufFactory
Returns the value of thedataBufFactoryrecord component.- Returns:
- the value of the
dataBufFactoryrecord component
-
extendingClass
Returns the value of theextendingClassrecord component.- Returns:
- the value of the
extendingClassrecord component
-
interfaces
Returns the value of theinterfacesrecord component.- Returns:
- the value of the
interfacesrecord component
-
implementAllMethods
public boolean implementAllMethods()Returns the value of theimplementAllMethodsrecord component.- Returns:
- the value of the
implementAllMethodsrecord component
-