• 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
  • average (';' LIST )*

    Prev Next
    Macro
    Calculate the arithmetic mean (average) of numeric values in one or more lists

    Summary

    The average macro calculates the arithmetic mean of all numeric values provided in one or more semicolon-separated lists. Each list element is parsed as a double-precision floating-point number, and the result is the sum of all values divided by the count.

    Syntax

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

    Parameters

    • list - One or more semicolon-separated lists of numeric values. Values within each list can be comma-separated.

    Behavior

    • Parses all list elements as double-precision floating-point numbers
    • Calculates the sum of all values across all lists
    • Divides by the total number of values to get the average
    • Throws an exception if no values are provided

    Examples

    Calculate average of a simple list:

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

    Calculate average across multiple lists:

    ${average;10,20,30;40,50}
    # Returns: 30 (average of 10,20,30,40,50)
    

    Calculate average of decimal values:

    ${average;1.5,2.5,3.5}
    # Returns: 2.5
    

    Use Cases

    • Computing average build times or metric values
    • Calculating mean version numbers for analysis
    • Aggregating numeric configuration values
    • Statistical analysis of build data

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home