cloner 1.0.3 copy "cloner: ^1.0.3" to clipboard
cloner: ^1.0.3 copied to clipboard

Utilities for deep cloning collections and custom types with flexible extension points and optional circular reference detection.

1.0.3 #

Added #

  • Serialization support for cloner builders: Major cloner builders (BaseClonerBuilder, CountedClonerBuilder, HashedClonerBuilder) now implement ISerializable, allowing serialization and deserialization of builder configuration to/from strings. This enables saving and restoring cloner settings (can be handy for isolates)
  • Builder serialization helpers serializeBaseFlag and deserializeBaseFlag for encoding/decoding cloner configuration flags
  • Exception hierarchy: Introduced ACloneException and ASerializationException as base classes for cloning and serialization errors, respectively. Specific exceptions (e.g., UnsupportedTypedCloneException, LimitExceededException, CircularReferenceCloneException, DeserializationFormatException) now extend these bases

Changed #

  • ICloneable<T>.clone() method now accepts an optional ICloning parameter, allowing custom clone logic to receive the current cloner instance

Deprecations

  • replicate() method has been removed. Use the builder pattern (*Builder().build()) for cloner instantiation and configuration
  • Cloner.reference property is removed. Use Cloner.builder and Cloner.instance() for global cloner configuration and access.

1.0.2 #

Added #

  • Builder pattern for cloners: All cloner implementations (BaseCloner, CountedCloner, HashedCloner) now have corresponding *Builder classes (e.g., BaseClonerBuilder) for configuration and instantiation. This enables more flexible and idiomatic cloner construction
  • AdaptiveCloner: New AdaptiveCloner and AdaptiveClonerBuilder for dispatching cloning operations to different delegate cloners based on configuration (e.g., AOT/JIT, collection type)
  • MClonerLogging mixin: Add MClonerLogging for logging clone operations, with log history and optional printing.
  • Extensions accept custom cloner: Collection extension methods (clone, cloneDynamic) now accept an optional cloner parameter for explicit cloner usage

Changed #

  • Global cloner API: Cloner.reference is deprecated in favor of Cloner.builder (to leverage aforementioned builder pattern for global cloner configuration)
  • Cloner.instance now uses the builder
  • DEPRECATED replicate(): The replicate() method on cloners is deprecated and will be removed in a future release
  • Extensions: Collection extensions now use the builder-based cloner and allow passing a custom cloner

Fixed #

  • CountedCloner nesting depth limit now takes in account only collections (cloneValue() is excluded)

1.0.1 #

Added #

  • New CountedCloner and HashedCloner implementations:
    • CountedCloner enforces recursion depth and total clone count limits to prevent stack overflows and runaway cloning.
    • HashedCloner provides circular reference detection for collections, throwing CircularReferenceCloneException on cycles.
  • LimitExceededException for reporting exceeded size/nesting limits during cloning.
  • Benchmarks and performance recommendations for different cloner implementations (see doc/benchmarks)

Changed #

  • Cloner now uses CountedCloner as the default global cloner instead of BaseCloner
  • ICloning.replicate signature simplified: removed doCircRefCheck parameter (circular reference detection is now handled by HashedCloner)
  • Collection extension methods (clone, cloneDynamic) no longer accept doCircRefCheck parameter
  • Improved documentation and README with new "Benchmarks" and "Worth Noting" sections

Fixed #

  • Improved test coverage for circular reference and limit enforcement scenarios

1.0.0 #

Initial version #

  • ICloneable and ICopyable contracts for custom deep/shallow copy support
  • Cloner facade with pluggable backend
  • BaseCloner default implementation and ICloning interface for custom cloners
    • Element/value-wise deep cloning for List, Set, and Map
    • Optional circular-reference detection
  • Collection extensions: List.clone() / Set.clone() / Map.clone()
  • MapClone typed map wrapper for safe nested typed map cloning and copy()/clone() helpers
  • Typed-clone safety checks and UnsupportedTypedCloneException for unsupported typed scenarios
  • Preserves common concrete collection implementations (LinkedHashMap, HashMap) where possible
0
likes
0
points
501
downloads

Publisher

unverified uploader

Weekly Downloads

Utilities for deep cloning collections and custom types with flexible extension points and optional circular reference detection.

Repository (GitLab)
View/report issues

License

unknown (license)

More

Packages that depend on cloner