eu.planets_project.services.datatypes
Class DigitalObject.Builder

java.lang.Object
  extended by eu.planets_project.services.datatypes.DigitalObject.Builder
Enclosing interface:
DigitalObject

public static final class DigitalObject.Builder
extends java.lang.Object

Builder for DigitalObject instances. Using a builder ensures consistent object state during creation and models optional named constructor parameters.

See Also:
eu.planets_project.services.datatypes.DigitalObjectTests

Constructor Summary
DigitalObject.Builder(DigitalObject digitalObject)
           
DigitalObject.Builder(DigitalObjectContent content)
          Constructs an anonymous (permanentUri == null) digital object.
DigitalObject.Builder(java.lang.String digitalObjectXml)
          Creates a builder that will build a digital object identical to the given object, including the permanent URI.
 
Method Summary
 DigitalObject build()
           
 DigitalObject.Builder content(DigitalObjectContent content)
           
 DigitalObject.Builder events(Event... events)
           
 DigitalObject.Builder format(java.net.URI format)
           
 DigitalObject.Builder fragments(java.lang.String... fragments)
           
 DigitalObjectContent getContent()
           
 java.util.List<Event> getEvents()
           
 java.net.URI getFormat()
           
 java.util.List<java.lang.String> getFragments()
           
 java.net.URI getManifestationOf()
           
 java.util.List<Metadata> getMetadata()
           
 java.net.URI getPermanentUri()
           
 java.lang.String getTitle()
           
 DigitalObject.Builder manifestationOf(java.net.URI manifestationOf)
           
 DigitalObject.Builder metadata(Metadata... metadata)
           
 DigitalObject.Builder permanentUri(java.net.URI permanentUri)
           
 DigitalObject.Builder title(java.lang.String title)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigitalObject.Builder

public DigitalObject.Builder(DigitalObjectContent content)
Constructs an anonymous (permanentUri == null) digital object. To set further attributes, call the desired methods on the resulting builder.

Parameters:
content - The content of the digital object, see static factory methods in Content for different ways of content creation, e.g. Content.byReference(file).

DigitalObject.Builder

public DigitalObject.Builder(DigitalObject digitalObject)
Parameters:
digitalObject - An existing digital object to copy into an new anonymous (permanentUri == null) digital object.

DigitalObject.Builder

public DigitalObject.Builder(java.lang.String digitalObjectXml)
Creates a builder that will build a digital object identical to the given object, including the permanent URI.

Parameters:
digitalObjectXml - An XML representation of a digital object.
Method Detail

build

public DigitalObject build()
Returns:
The instance created using this builder.

content

public DigitalObject.Builder content(DigitalObjectContent content)
Parameters:
content - The new content for the digital object to be created, see static factory methods in Content for different ways of content creation, e.g. Content.byReference(file).
Returns:
The builder, for cascaded calls

permanentUri

public DigitalObject.Builder permanentUri(java.net.URI permanentUri)
Parameters:
permanentUri - The globally unique identifier for this digital object.
Returns:
The builder, for cascaded calls

events

public DigitalObject.Builder events(Event... events)
Parameters:
events - The events of the digital object
Returns:
The builder, for cascaded calls

fragments

public DigitalObject.Builder fragments(java.lang.String... fragments)
Parameters:
fragments - The fragments the digital object is made of
Returns:
The builder, for cascaded calls

manifestationOf

public DigitalObject.Builder manifestationOf(java.net.URI manifestationOf)
Parameters:
manifestationOf - What the digital object is a manifestation of
Returns:
The builder, for cascaded calls

title

public DigitalObject.Builder title(java.lang.String title)
Parameters:
title - The title of the digital object
Returns:
The builder, for cascaded calls

metadata

public DigitalObject.Builder metadata(Metadata... metadata)
Parameters:
metadata - Additional metadata for the digital object
Returns:
The builder, for cascaded calls

format

public DigitalObject.Builder format(java.net.URI format)
Parameters:
format - The type of the digital object
Returns:
The builder, for cascaded calls

getContent

public DigitalObjectContent getContent()
Returns:
The content
See Also:
DigitalObject.getContent()

getPermanentUri

public java.net.URI getPermanentUri()
Returns:
The permanent URI
See Also:
DigitalObject.getPermanentUri()

getEvents

public java.util.List<Event> getEvents()
Returns:
The events
See Also:
DigitalObject.getEvents()

getFragments

public java.util.List<java.lang.String> getFragments()
Returns:
The fragments
See Also:
DigitalObject.getFragments()

getManifestationOf

public java.net.URI getManifestationOf()
Returns:
The abstraction this object is a manifestation of
See Also:
DigitalObject.getManifestationOf()

getMetadata

public java.util.List<Metadata> getMetadata()
Returns:
The metadata
See Also:
DigitalObject.getMetadata()

getFormat

public java.net.URI getFormat()
Returns:
The format
See Also:
DigitalObject.getFormat()

getTitle

public java.lang.String getTitle()
Returns:
The title
See Also:
DigitalObject.getTitle()


Copyright © 2007-2010 The Planets Consortium. All Rights Reserved.