more about builder pattern
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/b4342b94 Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/b4342b94 Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/b4342b94 Branch: refs/heads/master Commit: b4342b94fa6ff992986bf6141325f97d6d6a4583 Parents: c3fd214 Author: Stian Soiland-Reyes <st...@apache.org> Authored: Sun Apr 3 02:54:28 2016 +0100 Committer: Stian Soiland-Reyes <st...@apache.org> Committed: Sun Apr 3 02:54:28 2016 +0100 ---------------------------------------------------------------------- .../org/apache/commons/rdf/api/RDFParserBuilder.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b4342b94/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java b/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java index 03dcc48..bc7d750 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java @@ -29,8 +29,16 @@ import java.util.concurrent.Future; * This interface follows the * <a href="https://en.wikipedia.org/wiki/Builder_pattern">Builder pattern</a>, * allowing to set parser settings like {@link #contentType(RDFSyntax)} and - * {@link #base(IRI)}. A caller MUST call one of the {@link #source(IRI)} - * methods before calling {@link #parse()} on the returned RDFParserBuilder. + * {@link #base(IRI)}. A caller MUST call one of the <code>source</code> methods + * (e.g. {@link #source(IRI)}, {@link #source(Path)}, + * {@link #source(InputStream)}) before calling {@link #parse()} on the returned + * RDFParserBuilder - however methods can be called in any order. + * <p> + * Setting a method that has already been set will override any existing value + * in the returned builder - irregardless of the parameter type (e.g. + * {@link #source(IRI)} will override a previous {@link #source(Path)}. Settings + * can be unset by passing <code>null</code> - this may require casting, e.g. + * <code>contentType( (RDFSyntax) null )</code>. * <p> * It is undefined if a RDFParserBuilder is mutable or thread-safe, so callers * should always use the returned modified RDFParserBuilder from the builder