Class BuilderPatternExample

java.lang.Object
de.pauleff.examples.BuilderPatternExample

public class BuilderPatternExample extends Object
Demonstrates the NBT builder pattern for creating complex structures. Shows different approaches to handle nested structures and when to use each method.

Key concepts demonstrated:

  • Simple compound building with terminal operations
  • Single-level nesting where end() is safe and simple
  • Complex chaining requiring type-safe endCompound()/endList()
  • Variable storage pattern as alternative to complex chaining
  • File integration and modification patterns

When to use each approach:

  • end() - Terminal operations, simple nesting, variable storage
  • endCompound()/endList() - Complex chaining, type safety
  • Variable storage - Very complex structures, conditional building
Author:
Paul Ferlitz
  • Constructor Details

    • BuilderPatternExample

      public BuilderPatternExample()
  • Method Details