Package aQute.libg.sed
Class ReplacerAdapter
java.lang.Object
aQute.libg.reporter.ReporterAdapter
aQute.libg.sed.ReplacerAdapter
Provide a macro Domain. This Domain 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 Domain (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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
(package private) static String
static final String
(package private) static String
(package private) static String
(package private) static String
(package private) static String
(package private) static String
toclassname ;.class ( , .class ) * (package private) static String
toclassname ;.class ( , .class ) * (package private) static String
Return a unique list where the duplicates are removed.(package private) File
private static final Pattern
Parse the key as a command.private static final DateTimeFormatter
(package private) Domain
(package private) boolean
(package private) static final Random
(package private) Reporter
private static final Pattern
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFormat bytesGet the contents of a file._currenttime
(String[] args) _filterout
(String[] args) _fmodified
(String[] args) long
_freeMemory
(String[] args) _long2date
(String[] args) Wildcard a directory.long
_maxMemory
(String[] args) long
_pathseparator
(String[] args) int
_processors
(String[] args) Generate a random string, which is guaranteed to be a valid Java identifier (first character is an ASCII letter, subsequent characters are ASCII letters or numbers).replace ;- ; regex ; replace
_separator
(String[] args) _system_allow_fail
(String[] args) _toclassname
(String[] args) _toclasspath
(String[] args) void
private void
private String
private String
doCommands
(String key, ReplacerAdapter.Link source) (package private) String
int
findMacro
(CharSequence line, int index) Traverses a string to find a macro.Take all the properties and translate them to actual values.static Properties
getProcessed
(String key) static char
getTerminator
(char c) (package private) String
(package private) int
process
(CharSequence org, int index, char begin, char end, StringBuilder result, ReplacerAdapter.Link link) (package private) String
process
(String line, ReplacerAdapter.Link link) void
removeTarget
(Object target) protected String
replace
(String key, ReplacerAdapter.Link link) void
setReporter
(Reporter reporter) system_internal
(boolean allowFail, String[] args) System command.static void
verifyCommand
(String[] args, String help, Pattern[] patterns, int low, int high) Methods inherited from class aQute.libg.reporter.ReporterAdapter
addErrors, addWarnings, check, error, exception, getErrors, getInfo, getInfo, getLocation, getMessages, getOut, getWarnings, isExceptions, isOk, isPedantic, isPerfect, isTrace, progress, report, run, setExceptions, setPedantic, setTrace, trace, warning
-
Field Details
-
random
-
WILDCARD
-
domain
Domain domain -
targets
-
flattening
boolean flattening -
base
File base -
reporter
Reporter reporter -
commands
Parse the key as a command. A command consist of parameters separated by ':'. -
_uniqHelp
Return a unique list where the duplicates are removed. -
_filterHelp
-
_sortHelp
-
_nsortHelp
-
_joinHelp
-
_ifHelp
-
DATE_TOSTRING
-
_fmodifiedHelp
- See Also:
-
_toclassnameHelp
toclassname ;.class ( , .class ) * -
_toclasspathHelp
toclassname ;.class ( , .class ) * -
_fileHelp
- See Also:
-
-
Constructor Details
-
ReplacerAdapter
-
ReplacerAdapter
-
-
Method Details
-
target
-
target
-
process
-
process
-
process
int process(CharSequence org, int index, char begin, char end, StringBuilder result, ReplacerAdapter.Link link) -
findMacro
Traverses a string to find a macro. It can handle nested brackets.- Parameters:
line
- The line with the macroindex
- Points to the character after the '$'- Returns:
- the end position
-
getTerminator
public static char getTerminator(char c) -
getProcessed
-
replace
-
getAllKeys
-
doCommands
-
doCommand
-
_uniq
-
_pathseparator
-
_separator
-
_filter
-
_filterout
-
filter
-
_sort
-
_nsort
-
_join
-
_if
-
_now
-
_fmodified
- Throws:
Exception
-
_long2date
-
_literal
-
_def
-
_replace
replace ;- ; regex ; replace
- Parameters:
args
-- Returns:
- result
-
_warning
-
_error
-
_toclassname
-
_toclasspath
-
_dir
-
_basename
-
_isfile
-
_isdir
-
_tstamp
-
_lsr
Wildcard a directory. The lists can contain Instruction that are matched against the given directory ${lsr;; - (;
- )*} ${lsa;
; - (;
- )*}
-
_lsa
-
ls
-
_currenttime
-
system_internal
System command. Execute a command and insert the result.- Throws:
Exception
-
_system
- Throws:
Exception
-
_system_allow_fail
- Throws:
Exception
-
_env
-
_cat
Get the contents of a file.- Returns:
- contents of file
- Throws:
IOException
-
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.- Returns:
- A new Properties with the flattened values
-
_osfile
-
_path
-
getParent
-
process
-
_random
Generate a random string, which is guaranteed to be a valid Java identifier (first character is an ASCII letter, subsequent characters are ASCII letters or numbers). Takes an optional parameter for the length of string to generate; default is 8 characters. -
setReporter
-
_processors
-
_maxMemory
-
_freeMemory
-
_nanoTime
-
addTarget
-
removeTarget
-
_unescape
-
_bytes
Format bytes -
bytes
-