• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • reverse (';' LIST )*

    Prev Next
    Macro
    Reverse the order of elements in one or more lists

    Summary

    The reverse macro reverses the order of elements from one or more combined lists. The last element becomes first, and the first becomes last.

    Syntax

    ${reverse;<list>[;<list>...]}
    

    Parameters

    • list - One or more semicolon-separated lists (items within lists are comma-separated)

    Behavior

    • Combines all provided lists into a single list
    • Reverses the order of all elements
    • Returns the reversed list as a comma-separated string

    Examples

    Reverse a simple list:

    ${reverse;1,2,3,4,5}
    # Returns: "5,4,3,2,1"
    

    Reverse text items:

    ${reverse;apple,banana,cherry}
    # Returns: "cherry,banana,apple"
    

    Reverse multiple lists:

    ${reverse;red,green;blue,yellow}
    # Returns: "yellow,blue,green,red"
    

    Reverse file list:

    ${reverse;${lsr;src;*.java}}
    # Returns files in reverse order
    

    Use Cases

    • Reversing lists for processing in opposite order
    • Creating descending sort orders
    • Stack-like operations (LIFO)
    • Reversing dependency orders
    • Changing processing sequence
    • List manipulation

    Notes

    • The entire combined list is reversed
    • Element values are not modified, only their order
    • Empty lists return empty results
    • Useful for reordering sorted lists
    • Can be combined with ${sort} for descending order

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home