You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2006/06/28 21:05:15 UTC

Re: svn commit: r417828 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/parser/ core/src/main/java/org/apache/abdera/util/ core/src/main/java/org/apache/abdera/writer/ parser/src/main/java/org/apache/abdera/parser/stax/

On 6/28/06, jmsnell@apache.org <jm...@apache.org> wrote:
> Author: jmsnell
> Date: Wed Jun 28 10:51:56 2006
> New Revision: 417828
>
> URL: http://svn.apache.org/viewvc?rev=417828&view=rev
> Log:
> Adding custom parser/writer support
>
> This introduces the concept of named parsers and named writers.  For instance, if I wanted to have
> a JSON serialization of a set of Abdera objects, I could do something like:
>
>   Writer writer = WriterFactory.INSTANCE.getInstance("json");

Maybe it's just me, but .INSTANCE.getInstance() seems kind of weird.
We have to get an instance of our factor, and use that to get an
instance of a writer?  Is it just me, or is maybe this stuff getting a
bit too overly abstract?

Also...

> @@ -93,5 +93,31 @@
>      ParserOptions options)
>        throws ParseException, URISyntaxException;
>
> +  <T extends Element>Document<T> parse(
> +      Object in)
> +        throws ParseException;
> +
> +  <T extends Element>Document<T> parse(
> +    Object in,
> +    URI base)
> +      throws ParseException;
> +
> +  <T extends Element>Document<T> parse(
> +    Object in,
> +    URI base,
> +    ParserOptions options)
> +      throws ParseException;
> +
> +  <T extends Element>Document<T> parse(
> +    Object in,
> +    String base)
> +      throws ParseException, URISyntaxException;
> +
> +  <T extends Element>Document<T> parse(
> +    Object in,
> +    String base,
> +    ParserOptions options)
> +      throws ParseException, URISyntaxException;
> +
>    ParserOptions getDefaultParserOptions();
>  }

I'm not overly thrilled with the idea of adding parse(Object foo)
methods...  Doesn't that basically kill any benefit from static typing
we once had here?  Compile time errors are now run time errors...

-garrett

Re: svn commit: r417828 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/parser/ core/src/main/java/org/apache/abdera/util/ core/src/main/java/org/apache/abdera/writer/ parser/src/main/java/org/apache/abdera/parser/stax/

Posted by James M Snell <ja...@gmail.com>.
Yes, I'm hoping that this is relatively temporary.  I'm doing this for
now so we can get a couple of custom parser/writer implementations
written up, then we can see what makes the most sense.  In other words,
consider this to be a work in progress.

- James

Garrett Rooney wrote:
> On 6/28/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> Author: jmsnell
>> Date: Wed Jun 28 10:51:56 2006
>> New Revision: 417828
>>
>> URL: http://svn.apache.org/viewvc?rev=417828&view=rev
>> Log:
>> Adding custom parser/writer support
>>
>> This introduces the concept of named parsers and named writers.  For
>> instance, if I wanted to have
>> a JSON serialization of a set of Abdera objects, I could do something
>> like:
>>
>>   Writer writer = WriterFactory.INSTANCE.getInstance("json");
> 
> Maybe it's just me, but .INSTANCE.getInstance() seems kind of weird.
> We have to get an instance of our factor, and use that to get an
> instance of a writer?  Is it just me, or is maybe this stuff getting a
> bit too overly abstract?
> 
> Also...
> 
>> @@ -93,5 +93,31 @@
>>      ParserOptions options)
>>        throws ParseException, URISyntaxException;
>>
>> +  <T extends Element>Document<T> parse(
>> +      Object in)
>> +        throws ParseException;
>> +
>> +  <T extends Element>Document<T> parse(
>> +    Object in,
>> +    URI base)
>> +      throws ParseException;
>> +
>> +  <T extends Element>Document<T> parse(
>> +    Object in,
>> +    URI base,
>> +    ParserOptions options)
>> +      throws ParseException;
>> +
>> +  <T extends Element>Document<T> parse(
>> +    Object in,
>> +    String base)
>> +      throws ParseException, URISyntaxException;
>> +
>> +  <T extends Element>Document<T> parse(
>> +    Object in,
>> +    String base,
>> +    ParserOptions options)
>> +      throws ParseException, URISyntaxException;
>> +
>>    ParserOptions getDefaultParserOptions();
>>  }
> 
> I'm not overly thrilled with the idea of adding parse(Object foo)
> methods...  Doesn't that basically kill any benefit from static typing
> we once had here?  Compile time errors are now run time errors...
> 
> -garrett
>