org.xwiki.resource
Class AbstractResource

java.lang.Object
  extended by org.xwiki.resource.AbstractResource
All Implemented Interfaces:
Resource
Direct Known Subclasses:
EntityResource

@Unstable
public abstract class AbstractResource
extends Object
implements Resource

Base XWiki Resource implementation common to all extending classes. Manages XWiki Resource parameters.

Since:
5.3M1
Version:
$Id: cfef88cb8bc7809e433ea9e886d1f087e0b73023 $

Constructor Summary
AbstractResource(ResourceType type)
           
 
Method Summary
 void addParameter(String name, String value)
           
 Map<String,List<String>> getParameters()
          A Resource parameter provides optional additional information about the Resource.
 String getParameterValue(String name)
           
 List<String> getParameterValues(String name)
           
 ResourceType getType()
           
 void setType(ResourceType type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractResource

public AbstractResource(ResourceType type)
Parameters:
type - see getType()
Method Detail

getType

public ResourceType getType()
Specified by:
getType in interface Resource
Returns:
the type of Resource (Entity Resource, Attachment Resource, Template Resource, etc)

setType

public void setType(ResourceType type)
Parameters:
type - see getType()

addParameter

public void addParameter(String name,
                         String value)
Specified by:
addParameter in interface Resource
Parameters:
name - the name of the parameter to add
value - the value of the parameter to add. If null then no value is added.

getParameters

public Map<String,List<String>> getParameters()
Description copied from interface: Resource
A Resource parameter provides optional additional information about the Resource. For example these will find their way into the Query String when the Resource is serialized to a standard URL. Note that there can be several values for the same name (since for example this is allowed in URLs and we want to map a URL to a XWiki Resource). Also note that the order in the map is the same as the order in the representation when it was parsed.

Specified by:
getParameters in interface Resource
Returns:
the Resource parameters

getParameterValues

public List<String> getParameterValues(String name)
Specified by:
getParameterValues in interface Resource
Parameters:
name - the parameter name for which to return the values
Returns:
all the parameter values matching the passed parameter name

getParameterValue

public String getParameterValue(String name)
Specified by:
getParameterValue in interface Resource
Parameters:
name - the parameter name for which to return the value
Returns:
the first parameter value matching the passed parameter name


Copyright © 2004–2014 XWiki. All rights reserved.