Package org.apache.wiki.ui

# Class AbstractCommand

java.lang.Object
org.apache.wiki.ui.AbstractCommand

All Implemented Interfaces:
  `Command`

Direct Known Subclasses:
  `GroupCommand`, `PageCommand`, `RedirectCommand`, `WikiCommand`

public abstract class AbstractCommand extends Object implements Command
Abstract, immutable Command implementation class. All of the fields in this class are `final`. This class is thread-safe.

Since:
  2.4.22

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractCommand(String requestContext, String urlPattern, String contentTemplate, Object target)`
Constructs a new Command with a specified wiki context, URL pattern, content template and target.

## Method Summary

Modifier and Type
Method
Description
`final String`
`getContentTemplate()`
`final String`
`getJSP()`
`protected final String`
`getJSPFriendlyName()`
Returns the "friendly name" for this command's JSP, namely a beatified version of the JSP's name without the .jsp suffix.
`abstract String`
`getName()`
`final String`
`getRequestContext()`
`final Object`
`getTarget()`
`final String`
`getURLPattern()`
`abstract Command`
`targetedCommand(Object target)`
`final String`
`toString()`
Returns a String representation of the Command.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.wiki.api.core.Command

`requiredPermission`

## Constructor Details

### AbstractCommand

protected AbstractCommand(String requestContext, String urlPattern, String contentTemplate, Object target)
Constructs a new Command with a specified wiki context, URL pattern, content template and target. The URL pattern is used to derive the JSP; if it is a "local" JSP (that is, it does not contain the `http://` or `https://` prefixes), then the JSP will be a cleansed version of the URL pattern; symbols (such as `%u`) will be removed. If the supplied URL pattern points to a non-local destination, the JSP will be set to the value supplied, unmodified.

Parameters:
  `requestContext` - the request context
  `urlPattern` - the URL pattern
  `contentTemplate` - the content template; may be `null`
  `target` - the target of the command, such as a WikiPage; may be `null`
Throws:
  `IllegalArgumentException` - if the request content or URL pattern is `null`

## Method Details

### targetedCommand

public abstract Command targetedCommand(Object target)

Specified by:
  `targetedCommand` in interface `Command`
See Also:
  - `Command.targetedCommand(Object)`

### getContentTemplate

public final String getContentTemplate()

Specified by:
  `getContentTemplate` in interface `Command`
See Also:
  - `Command.getContentTemplate()`

### getJSP

public final String getJSP()

Specified by:
  `getJSP` in interface `Command`
See Also:
  - `Command.getJSP()`

### getName

public abstract String getName()

Specified by:
  `getName` in interface `Command`
See Also:
  - `Command.getName()`

### getRequestContext

public final String getRequestContext()

Specified by:
  `getRequestContext` in interface `Command`
See Also:
  - `Command.getRequestContext()`

### getTarget

public final Object getTarget()

Specified by:
  `getTarget` in interface `Command`
See Also:
  - `Command.getTarget()`

### getURLPattern

public final String getURLPattern()

Specified by:
  `getURLPattern` in interface `Command`
See Also:
  - `Command.getURLPattern()`

### getJSPFriendlyName

protected final String getJSPFriendlyName()
Returns the "friendly name" for this command's JSP, namely a beatified version of the JSP's name without the .jsp suffix.

Returns:
  the friendly name

### toString

public final String toString()
Returns a String representation of the Command.

Overrides:
  `toString` in class `Object`
See Also:
  - `Object.toString()`