withOptions method
- RdfGraphEncoderOptions? encoder,
- RdfGraphDecoderOptions? decoder,
override
Creates a new instance with the specified options
This method returns a new Turtle codec configured with the provided encoder and decoder options. The original codec instance remains unchanged.
Parameters:
encoder
Optional encoder options to customize encoding behavior. Will be properly cast to TurtleEncoderOptions if possible, else we use just the options from the RdfGraphEncoderOptions class.decoder
Optional decoder options to customize decoding behavior. Will be properly cast to TurtleDecoderOptions if possible, else we use just the options from the RdfGraphDecoderOptions class.
Returns:
- A new TurtleCodec instance with the specified options applied, while preserving the original namespace mappings.
Implementation
@override
TurtleCodec withOptions({
RdfGraphEncoderOptions? encoder,
RdfGraphDecoderOptions? decoder,
}) {
return TurtleCodec(
namespaceMappings: _namespaceMappings,
encoderOptions: TurtleEncoderOptions.from(encoder ?? _encoderOptions),
decoderOptions: TurtleDecoderOptions.from(decoder ?? _decoderOptions),
);
}