Brooklyn

brooklyn.util.text
[Java] Class WildcardGlobs.SpecialistGlobExpander

java.lang.Object
  brooklyn.util.text.WildcardGlobs.SpecialistGlobExpander

public static class WildcardGlobs.SpecialistGlobExpander

expands globs as per #getGlobsAfterBraceExpansion, but also handles numeric ranges, and optionally allows customized treatment of quoted regions and/or parentheses.

simple example: machine-{0-3}-{a,b} returns 8 values, machine-0-a machine-0-b machine-1-a ... machine-3-b; NB leading zeroes are meaningful, so {00-03} expands as 00, 01, 02, 03

quote INTERIOR_NOT_EXPANDABLE example: a{b,"c,d"} return ab ac,d

for more detail on special treatment of quote and parentheses see PhraseTreatment and WildcardGlobsTest


Constructor Summary
WildcardGlobs.SpecialistGlobExpander(boolean expandNumericRanges, PhraseTreatment quoteTreatment, PhraseTreatment parenthesesTreatment)

 
Method Summary
java.util.List expand(java.lang.String glob)

expands glob, including custom syntax for numeric part

java.lang.String[] expandToArrayUnchecked(java.lang.String glob)

expands glob, including custom syntax for numeric part, but to an array, and re-throwing the checked exception as a runtime exception

boolean isGlobMatchedNumeric(java.lang.String globPattern, java.lang.String targetText)

returns true iff the target matches the given pattern, under simplified bash rules -- viz permitting * and ?

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

WildcardGlobs.SpecialistGlobExpander

public WildcardGlobs.SpecialistGlobExpander(boolean expandNumericRanges, PhraseTreatment quoteTreatment, PhraseTreatment parenthesesTreatment)


 
Method Detail

expand

public java.util.List expand(java.lang.String glob)
expands glob, including custom syntax for numeric part


expandToArrayUnchecked

public java.lang.String[] expandToArrayUnchecked(java.lang.String glob)
expands glob, including custom syntax for numeric part, but to an array, and re-throwing the checked exception as a runtime exception


isGlobMatchedNumeric

public boolean isGlobMatchedNumeric(java.lang.String globPattern, java.lang.String targetText)
returns true iff the target matches the given pattern, under simplified bash rules -- viz permitting * and ? and comma delimited patterns inside curly braces, as well as things like {1,2,5-10} (and also {01,02,05-10} to keep leading 0)
throws:
InvalidPatternException


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.