Class Metadata.Builder

java.lang.Object
io.jenetics.jpx.Metadata.Builder
Enclosing class:
Metadata

public static final class Metadata.Builder extends Object
Builder class for creating immutable Metadata objects.

Creating a GPX object with one track-segment and 3 track-points:

final Metadata gpx = Metadata.builder() .author("Franz Wilhelmstötter") .addLink(Link.of("http://jenetics.io")) .build();
  • Method Details

    • metadata

      public Metadata.Builder metadata(Metadata metadata)
      Adds the content of a given Metadata object.
      Parameters:
      metadata - the metadata content
      Returns:
      this Builder for method chaining
    • name

      public Metadata.Builder name(String name)
      Set the metadata name.
      Parameters:
      name - the metadata name
      Returns:
      this Builder for method chaining
    • name

      public Optional<String> name()
      Return the current name.
      Returns:
      the current name
      Since:
      1.3
    • desc

      public Metadata.Builder desc(String description)
      Set the metadata description.
      Parameters:
      description - the metadata description
      Returns:
      this Builder for method chaining
    • desc

      public Optional<String> desc()
      Return the current description.
      Returns:
      the current description
      Since:
      1.3
    • author

      public Metadata.Builder author(Person author)
      Set the metadata author.
      Parameters:
      author - the metadata author
      Returns:
      this Builder for method chaining
    • author

      public Metadata.Builder author(String author)
      Set the metadata author.
      Parameters:
      author - the metadata author
      Returns:
      this Builder for method chaining
    • author

      public Optional<Person> author()
      Return the current author.
      Returns:
      the current author
      Since:
      1.3
    • copyright

      public Metadata.Builder copyright(Copyright copyright)
      Set the copyright info.
      Parameters:
      copyright - the copyright info
      Returns:
      this Builder for method chaining
    • copyright

      Return the current copyright info.
      Returns:
      the current copyright info
      Since:
      1.3
    • links

      public Metadata.Builder links(List<Link> links)
      Set the metadata links.
      Parameters:
      links - the metadata links
      Returns:
      this Builder for method chaining
    • addLink

      public Metadata.Builder addLink(Link link)
      Add the given link to the metadata
      Parameters:
      link - the link to add to the metadata
      Returns:
      this Builder for method chaining
    • addLink

      Add the given link to the metadata
      Parameters:
      href - the link to add to the metadata
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given href is not a valid URL
    • links

      public List<Link> links()
      Return the current links.
      Returns:
      the current links
      Since:
      1.3
    • time

      public Metadata.Builder time(Instant time)
      Set the time of the metadata
      Parameters:
      time - the time of the metadata
      Returns:
      this Builder for method chaining
    • time

      public Metadata.Builder time(long millis)
      Set the time of the metadata.
      Parameters:
      millis - the instant to create the metadata time from
      Returns:
      this Builder for method chaining
    • time

      public Optional<Instant> time()
      Return the currently set time.
      Returns:
      the currently set time
      Since:
      1.3
    • keywords

      public Metadata.Builder keywords(String keywords)
      Set the metadata keywords.
      Parameters:
      keywords - the metadata keywords
      Returns:
      this Builder for method chaining
    • keywords

      Return the current keywords.
      Returns:
      the current keywords
      Since:
      1.3
    • bounds

      public Metadata.Builder bounds(Bounds bounds)
      Set the GPX bounds.
      Parameters:
      bounds - the GPX bounds
      Returns:
      this Builder for method chaining
    • bounds

      public Optional<Bounds> bounds()
      Return the current bounds.
      Returns:
      the current bounds
      Since:
      1.3
    • extensions

      public Metadata.Builder extensions(Document extensions)
      Sets the extensions object, which may be null. The root element of the extensions document must be extensions.
      <extensions> ... </extensions>
      Parameters:
      extensions - the document
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the root element is not the an extensions node
      Since:
      1.5
    • extensions

      Return the current extensions
      Returns:
      the extensions document
      Since:
      1.5
    • build

      public Metadata build()
      Create an immutable Metadata object from the current builder state.
      Returns:
      an immutable Metadata object from the current builder state