Package org.apache.struts2.views.velocity.components

# Class AbstractDirective

java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.apache.struts2.views.velocity.components.AbstractDirective

All Implemented Interfaces:
  `Cloneable`, `org.apache.velocity.runtime.directive.DirectiveConstants`

Direct Known Subclasses:
  `ActionDirective`, `ActionErrorDirective`, `ActionMessageDirective`, `AnchorDirective`, `BeanDirective`, `CheckBoxDirective`, `CheckBoxListDirective`, `ComboBoxDirective`, `ComponentDirective`, `DateDirective`, `DoubleSelectDirective`, `FieldErrorDirective`, `FileDirective`, `FormDirective`, `HeadDirective`, `HiddenDirective`, `I18nDirective`, `IncludeDirective`, `InputTransferSelectDirective`, `LabelDirective`, `OptGroupDirective`, `OptionTransferSelectDirective`, `ParamDirective`, `PasswordDirective`, `PropertyDirective`, `PushDirective`, `RadioDirective`, `ResetDirective`, `SelectDirective`, `SetDirective`, `SubmitDirective`, `TextAreaDirective`, `TextDirective`, `TextFieldDirective`, `TokenDirective`, `UpDownSelectDirective`, `URLDirective`

public abstract class AbstractDirective extends org.apache.velocity.runtime.directive.Directive

- ## Field Summary

  ### Fields inherited from class org.apache.velocity.runtime.directive.Directive

  `log, rsvc`

  ### Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants

  `BLOCK, LINE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDirective()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Map`
  `createPropertyMap(org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node)`
  Create a Map of properties that the user has passed in.
  `protected abstract Component`
  `getBean(ValueStack stack, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)`
  `abstract String`
  `getBeanName()`
  `String`
  `getName()`
  `int`
  `getType()`
  `protected void`
  `putProperty(Map propertyMap, org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node)`
  adds a given Node's key/value pair to the propertyMap.
  `boolean`
  `render(org.apache.velocity.context.InternalContextAdapter ctx, Writer writer, org.apache.velocity.runtime.parser.node.Node node)`

  ### Methods inherited from class org.apache.velocity.runtime.directive.Directive

  `checkArgs, getColumn, getLine, getScopeName, getTemplate, getTemplateName, init, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocation`

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

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

- ## Constructor Details

  - ### AbstractDirective

    public AbstractDirective()

- ## Method Details

  - ### getName

    public String getName()
    Specified by:
      `getName` in class `org.apache.velocity.runtime.directive.Directive`

  - ### getBeanName

    public abstract String getBeanName()

  - ### getType

    public int getType()
    Specified by:
      `getType` in class `org.apache.velocity.runtime.directive.Directive`
    Returns:
      All components, unless otherwise stated, are LINE-level directives.

  - ### getBean

    protected abstract Component getBean(ValueStack stack, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)

  - ### render

    public boolean render(org.apache.velocity.context.InternalContextAdapter ctx, Writer writer, org.apache.velocity.runtime.parser.node.Node node) throws IOException, org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, org.apache.velocity.exception.MethodInvocationException
    Specified by:
      `render` in class `org.apache.velocity.runtime.directive.Directive`
    Throws:
      `IOException`
      `org.apache.velocity.exception.ResourceNotFoundException`
      `org.apache.velocity.exception.ParseErrorException`
      `org.apache.velocity.exception.MethodInvocationException`

  - ### createPropertyMap

    protected Map createPropertyMap(org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node) throws org.apache.velocity.exception.ParseErrorException, org.apache.velocity.exception.MethodInvocationException

    Create a Map of properties that the user has passed in. For example:

         #xxx("name=hello" "value=world" "template=foo")

    would yield a params that contains {["name", "hello"], ["value", "world"], ["template", "foo"]}

    Parameters:
      `contextAdapter` - the context adapter
      `node` - the Node passed in to the render method
    Returns:
      a Map of the user specified properties
    Throws:
      `org.apache.velocity.exception.ParseErrorException` - if the was an error in the format of the property
      `org.apache.velocity.exception.MethodInvocationException`

  - ### putProperty

    protected void putProperty(Map propertyMap, org.apache.velocity.context.InternalContextAdapter contextAdapter, org.apache.velocity.runtime.parser.node.Node node) throws org.apache.velocity.exception.ParseErrorException, org.apache.velocity.exception.MethodInvocationException
    adds a given Node's key/value pair to the propertyMap. For example, if this Node contained the value "rows=20", then the key, rows, would be added to the propertyMap with the String value, 20.
    Parameters:
      `propertyMap` - a params containing all the properties that we wish to set
      `contextAdapter` - the context adapter
      `node` - the parameter to set expressed in "name=value" format
    Throws:
      `org.apache.velocity.exception.ParseErrorException` - in case of parsing errors
      `org.apache.velocity.exception.MethodInvocationException` - in case of method invocation errors