Class GenerationContext.Builder
java.lang.Object
eu.cloudnetservice.driver.network.rpc.generation.GenerationContext.Builder
- Enclosing class:
- GenerationContext
Represents a builder for a generation context.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Supplier<NetworkChannel>private NetworkComponentprivate DataBufFactoryprivate Class<?>private booleanprivate ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInterfaces(@NonNull Class<?>... interfaces) Adds the given interfaces to the set of interfaces which should get implemented by the generated class.build()Builds a new generation context based on this builder.channelSupplier(@Nullable Supplier<NetworkChannel> channelSupplier) Sets the supplier for the network component that is used when firing rpc.component(@Nullable NetworkComponent component) Sets the network component to use when firing rpc.dataBufFactory(@Nullable DataBufFactory dataBufFactory) Sets the databuf factory to use when creating databufs for the generation.extendingClass(@Nullable Class<?> extendingClass) Sets the class the generated classes based on the build context should extend.implementAllMethods(boolean implementAllMethods) Sets if all methods of the target class should get implemented or only abstract methods.interfaces(@NonNull Set<Class<?>> interfaces) Sets all interfaces the generated class based on the build context should implement.objectMapper(@Nullable ObjectMapper objectMapper) Sets the object mapper responsible for mapping a databuf back to an object.
-
Field Details
-
component
-
channelSupplier
-
objectMapper
-
dataBufFactory
-
extendingClass
-
implementAllMethods
private boolean implementAllMethods -
interfaces
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
component
@NonNull public @NonNull GenerationContext.Builder component(@Nullable @Nullable NetworkComponent component) Sets the network component to use when firing rpc.- Parameters:
component- the component used to fire.- Returns:
- the same instance of the builder, for chaining.
-
channelSupplier
@NonNull public @NonNull GenerationContext.Builder channelSupplier(@Nullable @Nullable Supplier<NetworkChannel> channelSupplier) Sets the supplier for the network component that is used when firing rpc.- Parameters:
channelSupplier- the supplier used to fire.- Returns:
- the same instance of the builder, for chaining.
-
objectMapper
@NonNull public @NonNull GenerationContext.Builder objectMapper(@Nullable @Nullable ObjectMapper objectMapper) Sets the object mapper responsible for mapping a databuf back to an object.- Parameters:
objectMapper- the object mapper for mapping.- Returns:
- the same instance of the builder, for chaining.
-
dataBufFactory
@NonNull public @NonNull GenerationContext.Builder dataBufFactory(@Nullable @Nullable DataBufFactory dataBufFactory) Sets the databuf factory to use when creating databufs for the generation.- Parameters:
dataBufFactory- the databuf factory for the generation.- Returns:
- the same instance of the builder, for chaining.
-
extendingClass
@NonNull public @NonNull GenerationContext.Builder extendingClass(@Nullable @Nullable Class<?> extendingClass) Sets the class the generated classes based on the build context should extend.- Parameters:
extendingClass- the class to extend.- Returns:
- the same instance of the builder, for chaining.
- Throws:
NullPointerException- if the given class is null.
-
implementAllMethods
Sets if all methods of the target class should get implemented or only abstract methods.- Parameters:
implementAllMethods- if all methods should get implemented.- Returns:
- the same instance of the builder, for chaining.
-
interfaces
@NonNull public @NonNull GenerationContext.Builder interfaces(@NonNull @NonNull Set<Class<?>> interfaces) Sets all interfaces the generated class based on the build context should implement.- Parameters:
interfaces- the classes to implement.- Returns:
- the same instance of the builder, for chaining.
- Throws:
NullPointerException- if the given interface array is null.
-
addInterfaces
@NonNull public @NonNull GenerationContext.Builder addInterfaces(@NonNull @NonNull Class<?>... interfaces) Adds the given interfaces to the set of interfaces which should get implemented by the generated class.- Parameters:
interfaces- the interfaces to add.- Returns:
- the same instance of the builder, for chaining.
- Throws:
NullPointerException- if the given interface array is null.
-
build
Builds a new generation context based on this builder.- Returns:
- a new generation context based on this builder.
-