On Wed, Jan 6, 2010 at 3:27 PM, Thomas Mortagne
<thomas.morta...@xwiki.com>wrote:

> On Wed, Jan 6, 2010 at 15:21, Vincent Massol <vinc...@massol.net> wrote:
> > Hi,
> >
> > This is the current interface:
> >
> > public interface EntityReferenceFactory<T>
> > {
> >    /**
> >     * @param entityReferenceRepresentation the representation of an
> entity reference (eg as a String)
> >     * @param type the type of the Entity (Document, Space, Attachment,
> Wiki, etc) to extract from the source
> >     * @return the resolved reference as an Object
> >     */
> >    EntityReference createEntityReference(T entityReferenceRepresentation,
> EntityType type);
> > }
> >
> > Now we have 2 different implementations:
> > - one for which T = String
> > - one for which T = EntityReference (our normalizer)
> >
> > In term of usage this means:
> >
> > EntityReference ref = factory.createEntityReference("wiki:space.page",
> EntityType.DOCUMENT);
> > EntityReference ref = factory.createEntityReference(documentReference,
> EntityType.DOCUMENT);
> >
> > The last example is used to normalize the passed reference, convert it
> into the type specified by the second parameter, filling the blanks.
> >
> > I feel that Factory is no longer an appropriate name, especially for the
> second use case. WDYT?
> >
> > IMO a better name would be Resolver, Normalizer, or Converter. Any other
> better name? (I haven't put Parser since I don't believe it's correct).
> >
> > Examples:
> >
> > EntityReference ref = resolver.resolve("wiki:space.page",
> EntityType.DOCUMENT);
> > EntityReference ref = resolver.resolve(documentReference,
> EntityType.DOCUMENT);
> >
> > EntityReference ref = normalizer.normalize("wiki:space.page",
> EntityType.DOCUMENT);
> > EntityReference ref = normalizer.normalize(documentReference,
> EntityType.DOCUMENT);
> >
> > EntityReference ref = converter.convert("wiki:space.page",
> EntityType.DOCUMENT);
> > EntityReference ref = converter.convert(documentReference,
> EntityType.DOCUMENT);
> >
> > It's quite a lot of work to change what I have put but since this is an
> important API we need to be sure of what we want since we won't be able to
> change it later on.
> >
> > I'm +1 for Resolver.
>
> +1 for Resolver
>
>
+1 for resolver also... normalizer is a bit too much abstract IMO


> >
> > WDYT?
> >
> > Thanks
> > -Vincent
> >
> > _______________________________________________
> > devs mailing list
> > devs@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
>
>
>
> --
> Thomas Mortagne
> _______________________________________________
> devs mailing list
> devs@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
devs@xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to