copyWith method
TurtleEncoderOptions
copyWith({
- Map<
String, String> ? customPrefixes, - bool? generateMissingPrefixes,
- bool? useNumericLocalNames,
- bool? includeBaseDeclaration,
- bool? renderFragmentsAsPrefixed,
- IriRelativizationOptions? iriRelativization,
override
This method allows creating a new TurtleEncoderOptions instance based on the current options, selectively overriding specific fields while keeping all other settings unchanged.
Parameters:
customPrefixesOptional replacement for the custom namespace prefixesgenerateMissingPrefixesOptional replacement for the automatic prefix generation settinguseNumericLocalNamesOptional replacement for the numeric local names handling settingincludeBaseDeclarationOptional replacement for the base declaration inclusion settingrenderFragmentsAsPrefixedOptional replacement for the fragment rendering setting
Returns:
- A new TurtleEncoderOptions instance with the specified changes applied
Example:
final originalOptions = TurtleEncoderOptions(
generateMissingPrefixes: true,
useNumericLocalNames: false
);
final modifiedOptions = originalOptions.copyWith(
generateMissingPrefixes: false,
customPrefixes: {'ex': 'http://example.org/'}
);
Implementation
@override
TurtleEncoderOptions copyWith(
{Map<String, String>? customPrefixes,
bool? generateMissingPrefixes,
bool? useNumericLocalNames,
bool? includeBaseDeclaration,
bool? renderFragmentsAsPrefixed,
IriRelativizationOptions? iriRelativization}) =>
TurtleEncoderOptions(
customPrefixes: customPrefixes ?? this.customPrefixes,
generateMissingPrefixes:
generateMissingPrefixes ?? this.generateMissingPrefixes,
useNumericLocalNames: useNumericLocalNames ?? this.useNumericLocalNames,
includeBaseDeclaration:
includeBaseDeclaration ?? this.includeBaseDeclaration,
renderFragmentsAsPrefixed:
renderFragmentsAsPrefixed ?? this.renderFragmentsAsPrefixed,
iriRelativization: iriRelativization ?? this.iriRelativization,
);