org.xwiki.component.wiki.internal
Class DefaultWikiComponent

java.lang.Object
  extended by org.xwiki.component.wiki.internal.DefaultWikiComponent
All Implemented Interfaces:
WikiComponent

public class DefaultWikiComponent
extends Object
implements WikiComponent

Default implementation of a wiki component definition.

Since:
4.2M3

Constructor Summary
DefaultWikiComponent(DocumentReference documentReference, DocumentReference authorReference, Type roleType, String roleHint, WikiComponentScope scope)
          Constructor of this component.
 
Method Summary
 DocumentReference getAuthorReference()
          Get the reference to the author of the document this component instance is bound to.
 Map<String,ComponentDescriptor> getDependencies()
          Methods returned by getHandledMethods() can require other components to be injected in their context.
 DocumentReference getDocumentReference()
          Get the reference of the document this component instance is bound to.
 Map<String,XDOM> getHandledMethods()
          Get the implementations of all the methods the component handles.
 List<Class<?>> getImplementedInterfaces()
          Get the list of interfaces the wiki component implements, apart from its main Role.
 String getRoleHint()
           
 Type getRoleType()
           
 WikiComponentScope getScope()
           
 Syntax getSyntax()
           
 void setDependencies(Map<String,ComponentDescriptor> dependencies)
          Sets the component dependencies.
 void setHandledMethods(Map<String,XDOM> methods)
          Sets the handled method.
 void setImplementedInterfaces(List<Class<?>> interfaces)
          Sets the implemented interfaces.
 void setSyntax(Syntax syntax)
          Set the syntax in which the component document is written.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWikiComponent

public DefaultWikiComponent(DocumentReference documentReference,
                            DocumentReference authorReference,
                            Type roleType,
                            String roleHint,
                            WikiComponentScope scope)
Constructor of this component.

Parameters:
documentReference - the document holding the component definition
authorReference - the author of the document holding the component definition
roleType - the role Type implemented
roleHint - the role hint for this role implementation
scope - the scope of this component
Method Detail

getDocumentReference

public DocumentReference getDocumentReference()
Description copied from interface: WikiComponent
Get the reference of the document this component instance is bound to.

Specified by:
getDocumentReference in interface WikiComponent
Returns:
the reference to the document holding this wiki component definition.

getAuthorReference

public DocumentReference getAuthorReference()
Description copied from interface: WikiComponent
Get the reference to the author of the document this component instance is bound to.

Specified by:
getAuthorReference in interface WikiComponent
Returns:
the reference to the author of the document holding this wiki component definition.

getHandledMethods

public Map<String,XDOM> getHandledMethods()
Get the implementations of all the methods the component handles. It allows to write method implementations in wiki documents, using script macros. When a method has multiple signatures (different sets of parameters) the same XDOM will be executed.

Returns:
the map of method name/wiki code this component implementation handles.

getRoleType

public Type getRoleType()
Specified by:
getRoleType in interface WikiComponent
Returns:
the role implemented by this component implementation.

getRoleHint

public String getRoleHint()
Specified by:
getRoleHint in interface WikiComponent
Returns:
the hint of the role implemented by this component implementation.

getScope

public WikiComponentScope getScope()
Specified by:
getScope in interface WikiComponent
Returns:
the WikiComponentScope of the component.

getImplementedInterfaces

public List<Class<?>> getImplementedInterfaces()
Get the list of interfaces the wiki component implements, apart from its main Role. When the component is entirely written in a document, it allows the WikiComponentManager to add those Interfaces to the list of implemented interfaces of the Proxy it will create.

Returns:
the extra list of interfaces this component implementation implements.

getDependencies

public Map<String,ComponentDescriptor> getDependencies()
Methods returned by getHandledMethods() can require other components to be injected in their context. Each entry in the map returned by this method will be injected in the rendering context when methods will be executed. The name of the variable in the context is defined by the key in the returned Map.

Returns:
the map of dependencies of this component

getSyntax

public Syntax getSyntax()
Returns:
The syntax in which the component document is written

setHandledMethods

public void setHandledMethods(Map<String,XDOM> methods)
Sets the handled method.

Parameters:
methods - the methods this component will handle
See Also:
#getHandledMethods()}

setImplementedInterfaces

public void setImplementedInterfaces(List<Class<?>> interfaces)
Sets the implemented interfaces.

Parameters:
interfaces - the interfaces this component implements
See Also:
#getImplementedInterfaces()}

setDependencies

public void setDependencies(Map<String,ComponentDescriptor> dependencies)
Sets the component dependencies.

Parameters:
dependencies - the dependencies of this component

setSyntax

public void setSyntax(Syntax syntax)
Set the syntax in which the component document is written.

Parameters:
syntax - the syntax to set