Class Macro
java.lang.Object
aQute.bnd.osgi.Macro
Provide a macro processor. This processor can replace variables in strings
based on a properties and a domain. The domain can implement functions that
start with a "_" and take args[], the names of these functions are available
as functions in the macro processor (without the _). Macros can nest to any
depth but may not contain loops. Add POSIX macros: ${#parameter} String
length. ${parameter%word} Remove smallest suffix pattern. ${parameter%%word}
Remove largest suffix pattern. ${parameter#word} Remove smallest prefix
pattern. ${parameter##word} Remove largest prefix pattern.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription__testdebug(String[] args) Test macro to have exceptions, only active wheninTestis active.Get the Base64 encoding of a file._basenameext(String[] args) _bndversion(String[] args) Format bytesGet the contents of a file.int_currenttime(String[] args) _decorated(String[] args) Return the merged and decorated value of a macroGet a digest of a file._extension(String[] args) _filterout(String[] args) intint_fmodified(String[] args) intbooleanbooleanbooleanint_lastindexof(String[] args) int_long2date(String[] args) booleanint_pathseparator(String[] args) long_removeall(String[] args) _replacelist(String[] args) _replacestring(String[] args) _retainall(String[] args) _separator(String[] args) int_startswith(String[] args) _substring(String[] args) _system_allow_fail(String[] args) Take a macro name that maps to a Parameters and expand its entries using a template._toclassname(String[] args) _toclasspath(String[] args) int_version_cleanup(String[] args) _versionmask(String[] args) booleandoCondition(String arg) Get all the commands availableTake all the properties and translate them to actual values.getFlattenedProperties(boolean ignoreInstructions) Take all the properties and translate them to actual values.protected Stringstatic Propertiesstatic chargetTerminator(char c) booleanbooleanbooleansetNosystem(boolean nosystem) system_internal(boolean allowFail, String[] args) System command.static voidverifyCommand(String[] args, String help, Pattern[] patterns, int low, int high)
-
Field Details
-
inTest
public boolean inTest -
_nowHelp
- See Also:
-
_fmodifiedHelp
- See Also:
-
_fileHelp
-
_sizeHelp
- See Also:
-
-
Constructor Details
-
Macro
-
-
Method Details
-
process
-
getTerminator
public static char getTerminator(char c) -
getMacro
-
replace
-
_uniq
-
_removeall
-
_retainall
-
_pathseparator
-
_separator
-
_filter
-
_select
-
_filterout
-
_reject
-
_sort
-
_nsort
-
_join
-
_sjoin
-
_if
-
isTruthy
-
_now
-
_fmodified
-
_long2date
-
_literal
-
_def
-
_list
-
_replace
-
_replacelist
-
_replacestring
-
_warning
-
_error
-
_toclassname
-
_toclasspath
-
_dir
-
_basename
-
_isfile
-
_isdir
-
_tstamp
-
_lsr
-
_lsa
-
_currenttime
-
_version
-
_versionmask
-
_range
-
system_internal
-
_system
-
_system_allow_fail
-
_env
-
_cat
Get the contents of a file.- Throws:
IOException
-
_base64
Get the Base64 encoding of a file.- Throws:
IOException
-
_digest
Get a digest of a file.- Throws:
NoSuchAlgorithmExceptionIOException
-
verifyCommand
-
getFlattenedProperties
Take all the properties and translate them to actual values. This method takes the set properties and traverse them over all entries, including the default properties for that properties. The values no longer contain macros.There are some rules
- Property names starting with an underscore ('_') are ignored. These are reserved for properties that cause an unwanted side effect when expanded unnecessary
- Property names starting with a minus sign ('-') are not expanded to maintain readability
- Returns:
- A new Properties with the flattened values
-
getFlattenedProperties
Take all the properties and translate them to actual values. This method takes the set properties and traverse them over all entries, including the default properties for that properties. The values no longer contain macros.Property names starting with an underscore ('_') are ignored. These are reserved for properties that cause an unwanted side effect when expanded unnecessary
- Returns:
- A new Properties with the flattened values
-
_osfile
-
_path
-
_size
-
getParent
-
process
-
isNosystem
public boolean isNosystem() -
setNosystem
public boolean setNosystem(boolean nosystem) -
_unescape
-
_startswith
-
_endswith
-
_extension
-
_basenameext
-
_bndversion
-
_stem
-
_substring
-
_rand
-
_length
-
_get
-
_sublist
-
_first
-
_last
-
_max
-
_min
-
_nmax
-
_nmin
-
_vmax
-
_vmin
-
_sum
-
_average
-
_reverse
-
_indexof
-
_lastindexof
-
_find
-
_findlast
-
_split
-
_js
-
_toupper
-
_tolower
-
_compare
-
_ncompare
-
_vcompare
-
_matches
-
_subst
- Throws:
Exception
-
_trim
-
_format
-
_isempty
-
_isnumber
-
_is
-
_map
-
_foreach
-
_apply
-
_bytes
-
_glob
-
doCondition
-
getCommands
-
_template
Take a macro name that maps to a Parameters and expand its entries using a template. The macro takes a macro name. It will merge and decorate this name before it applies it to the template. Each entry is mapped to the template. The template can use${@}for the key and${@attribute}for attributes.It would be nice to take the parameters value directly but this is really hard to do with the quoting. That is why we use a name. It is always possible to have an intermediate macro
- Parameters:
args- 'template', macro-name of Parameters, template, separator=','- Returns:
- the expanded template.
- Throws:
IOException
-
_decorated
-
__testdebug
-
_fileuri
-
_version_cleanup
-