Hi devs,

FYI as part of http://jira.xwiki.org/browse/XWIKI-8848 I've added some new APIs

    /**
     * Creates a {@link WikiReference} from a string representing the wiki name.
     *
     * @param wikiName the wiki name (eg "xwiki")
     * @return the reference to the wiki
     * @since 5.0M1
     */
    public WikiReference createWikiReference(String wikiName)
    {
        return new WikiReference(wikiName);
    }

    /**
     * Creates a {@link SpaceReference} from a string representing the space 
name.
     *
     * @param spaceName the space name (eg "Main")
     * @param parent the wiki reference in which the space is located
     * @return the reference to the space
     * @since 5.0M1
     */
    public SpaceReference createSpaceReference(String spaceName, WikiReference 
parent)
    {
        return new SpaceReference(spaceName, parent);
    }

    /**
     * Creates any {@link EntityReference} from a string.
     *
     * @param name the entity reference name (eg "page")
     * @param type the entity type (eg "wiki", "space", "document", etc)
     * @return the created reference
     * @since 5.0M1
     */
    public EntityReference createEntityReference(String name, EntityType type)
    {
        return new EntityReference(name, type);
    }

    /**
     * Creates any {@link EntityReference} from a string.
     *
     * @param name the entity reference name (eg "page")
     * @param type the entity type (eg "wiki", "space", "document", etc)
     * @param parent the entity parent
     * @return the created reference
     * @since 5.0M1
     */
    public EntityReference createEntityReference(String name, EntityType type, 
EntityReference parent)
    {
        return new EntityReference(name, type, parent);
    }

The last 2 are generic and allow for more complex use cases.

Let me know if you have better ideas.

Thanks
-Vincent

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to