org.apache.ivy.plugins.matcher.Matcher Java Examples
The following examples show how to use
org.apache.ivy.plugins.matcher.Matcher.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangingModuleDetector.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private Matcher getChangingMatcher() { if (!(resolver instanceof AbstractResolver)) { return NoMatcher.INSTANCE; } AbstractResolver abstractResolver = (AbstractResolver) resolver; String changingMatcherName = JavaReflectionUtil.method(AbstractResolver.class, String.class, "getChangingMatcherName").invoke(abstractResolver); String changingPattern = JavaReflectionUtil.method(AbstractResolver.class, String.class, "getChangingPattern").invoke(abstractResolver); if (changingMatcherName == null || changingPattern == null) { return NoMatcher.INSTANCE; } PatternMatcher matcher = abstractResolver.getSettings().getMatcher(changingMatcherName); if (matcher == null) { throw new IllegalStateException("unknown matcher '" + changingMatcherName + "'. It is set as changing matcher in " + this); } return matcher.getMatcher(changingPattern); }
Example #2
Source File: ChangingModuleDetector.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private Matcher getChangingMatcher() { if (!(resolver instanceof AbstractResolver)) { return NoMatcher.INSTANCE; } AbstractResolver abstractResolver = (AbstractResolver) resolver; String changingMatcherName = JavaReflectionUtil.method(AbstractResolver.class, String.class, "getChangingMatcherName").invoke(abstractResolver); String changingPattern = JavaReflectionUtil.method(AbstractResolver.class, String.class, "getChangingPattern").invoke(abstractResolver); if (changingMatcherName == null || changingPattern == null) { return NoMatcher.INSTANCE; } PatternMatcher matcher = abstractResolver.getSettings().getMatcher(changingMatcherName); if (matcher == null) { throw new IllegalStateException("unknown matcher '" + changingMatcherName + "'. It is set as changing matcher in " + this); } return matcher.getMatcher(changingPattern); }
Example #3
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 6 votes |
private long parseDuration(String duration) { if (duration == null) { return 0; } if ("eternal".equals(duration)) { return Long.MAX_VALUE; } java.util.regex.Matcher m = DURATION_PATTERN.matcher(duration); if (m.matches()) { // CheckStyle:MagicNumber| OFF int days = getGroupIntValue(m, 1); int hours = getGroupIntValue(m, 2); int minutes = getGroupIntValue(m, 3); int seconds = getGroupIntValue(m, 4); int millis = getGroupIntValue(m, 5); // CheckStyle:MagicNumber| ON return days * MILLIS_IN_DAY + hours * MILLIS_IN_HOUR + minutes * MILLIS_IN_MINUTES + seconds * MILLIS_IN_SECONDS + millis; } throw new IllegalArgumentException("invalid duration '" + duration + "': it must match " + DURATION_PATTERN.pattern() + " or 'eternal'"); }
Example #4
Source File: IvyEventFilter.java From ant-ivy with Apache License 2.0 | 6 votes |
public IvyEventFilter(String event, String filterExpression, PatternMatcher matcher) { this.matcher = (matcher == null) ? ExactPatternMatcher.INSTANCE : matcher; if (event == null) { nameFilter = NoFilter.instance(); } else { final Matcher eventNameMatcher = this.matcher.getMatcher(event); nameFilter = new Filter<IvyEvent>() { public boolean accept(IvyEvent e) { return eventNameMatcher.matches(e.getName()); } }; } if (isNullOrEmpty(filterExpression)) { attFilter = NoFilter.instance(); } else { attFilter = parseExpression(filterExpression); } }
Example #5
Source File: Match.java From ant-ivy with Apache License 2.0 | 6 votes |
public Matcher getPatternMatcher(ModuleRevisionId askedMrid) { String revision = askedMrid.getRevision(); List<String> args = split(getArgs()); List<String> argValues = getRevisionArgs(revision); if (args.size() != argValues.size()) { return new NoMatchMatcher(); } Map<String, String> variables = new HashMap<>(); for (String arg : args) { variables.put(arg, argValues.get(args.indexOf(arg))); } String pattern = getPattern(); pattern = IvyPatternHelper.substituteVariables(pattern, variables); PatternMatcher pMatcher = IvyContext.getContext().getSettings().getMatcher(matcher); return pMatcher.getMatcher(pattern); }
Example #6
Source File: SearchEngine.java From ant-ivy with Apache License 2.0 | 5 votes |
private void addMatcher(PatternMatcher patternMatcher, String expression, Map<String, Object> criteria, String key) { if (expression == null) { return; } Matcher matcher = patternMatcher.getMatcher(expression); if (matcher.isExact()) { criteria.put(key, expression); } else { criteria.put(key, matcher); } }
Example #7
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 5 votes |
private Matcher getChangingMatcher(CacheMetadataOptions options) { String changingPattern = options.getChangingPattern() != null ? options .getChangingPattern() : this.changingPattern; if (changingPattern == null) { return NoMatcher.INSTANCE; } String changingMatcherName = options.getChangingMatcherName() != null ? options .getChangingMatcherName() : this.changingMatcherName; PatternMatcher matcher = settings.getMatcher(changingMatcherName); if (matcher == null) { throw new IllegalStateException("unknown matcher '" + changingMatcherName + "'. It is set as changing matcher in " + this); } return matcher.getMatcher(changingPattern); }
Example #8
Source File: DefaultRepositoryCacheManager.java From ant-ivy with Apache License 2.0 | 4 votes |
private int getGroupIntValue(java.util.regex.Matcher m, int groupNumber) { String g = m.group(groupNumber); return isNullOrEmpty(g) ? 0 : Integer.parseInt(g); }