Brooklyn

brooklyn.util.text
[Java] Class WildcardGlobs

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

public class WildcardGlobs

Nested Class Summary
protected static class WildcardGlobs.ExpressionToExpand

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

static class WildcardGlobs.InvalidPatternException

enum WildcardGlobs.PhraseTreatment

if a string contains a demarcated phrase, e.g. between open and close parentheses, or inside unescaped quotes this argument determines how that phrase is treated with regards to brace expansion

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.

 
Method Summary
static java.util.List getGlobsAfterBraceExpansion(java.lang.String pattern)

returns a list with no curly braces in any entries, and guaranteeing order such that any {..

static java.util.List getGlobsAfterBraceExpansion(java.lang.String pattern, boolean allowNumericRanges, WildcardGlobs.PhraseTreatment quoteTreatment, WildcardGlobs.PhraseTreatment parenthesesTreatment)

returns a list with no curly braces in any entries; e.g. given a{,b} gives a and ab; quotes and parentheses are kept, but their contents may be excluded from expansion or otherwise treated specially as per the flag

static boolean isGlobMatched(java.lang.String globPattern, java.lang.String targetText)

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

static boolean isNoBraceGlobMatched(java.lang.String globPattern, java.lang.String target)

whether a glob-ish string without braces (e.g. containing just ?

 
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()
 

Method Detail

getGlobsAfterBraceExpansion

public static java.util.List getGlobsAfterBraceExpansion(java.lang.String pattern)
returns a list with no curly braces in any entries, and guaranteeing order such that any {..,X,..,Y,..} will result in X being before Y in the resulting list; e.g. given a{,b,c} gives a ab and ac; no special treatment of numeric ranges, quotes, or parentheses (see SpecialistGlobExpander for that)


getGlobsAfterBraceExpansion

public static java.util.List getGlobsAfterBraceExpansion(java.lang.String pattern, boolean allowNumericRanges, WildcardGlobs.PhraseTreatment quoteTreatment, WildcardGlobs.PhraseTreatment parenthesesTreatment)
returns a list with no curly braces in any entries; e.g. given a{,b} gives a and ab; quotes and parentheses are kept, but their contents may be excluded from expansion or otherwise treated specially as per the flag


isGlobMatched

public static boolean isGlobMatched(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
throws:
InvalidPatternException


isNoBraceGlobMatched

public static boolean isNoBraceGlobMatched(java.lang.String globPattern, java.lang.String target)
whether a glob-ish string without braces (e.g. containing just ? and * chars) matches; can be used directly, also used implicitly by isGlobMatched after glob expansion


 

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