@Nullable private String pregMatch(@Nullable String content, @RegExp String regular) { if(content == null) { return null; } Matcher matcher = Pattern.compile(regular, Pattern.MULTILINE).matcher(content); if(matcher.find()){ return matcher.group(1); } return null; }
@Nullable private String findTwice(@NotNull String content, @RegExp String regular) { Matcher matcher = Pattern.compile(regular, Pattern.MULTILINE).matcher(content); if(matcher.find()){ String domain = matcher.group(1); int start = matcher.end(); int end = start + Integer.parseInt(domain); return content.substring(start, end); } return null; } }
@Nullable private String getStringValue(@Nullable String content, @RegExp String regular) { if(content == null) { return null; } Matcher matcher = Pattern.compile(regular, Pattern.MULTILINE).matcher(content); if(matcher.find()){ String domain = matcher.group(1); int start = matcher.end(); int end = start + Integer.parseInt(domain); return content.substring(start + 1, end + 1); } return null; } }
@RegExp public static final String DOCTRINE_MAPPING = "doctrine-[\\w+-]*-*mapping";
/** * Verify no entry for member exists in index. * If a match is found then fail assertion error. * * @param classNamePattern the pattern to match className. * @param memberNamePattern the pattern to match member name. */ public void assertNoMemberMatches( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern, @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String memberNamePattern ) { assertNoMemberMatches( Pattern.compile( "^" + classNamePattern + "$" ), Pattern.compile( "^" + memberNamePattern + "$" ) ); }
/** * Verify at least one member exists in the index that matches patterns. * If a no match is found then fail assertion error. * * @param classNamePattern the pattern to match className. * @param memberNamePattern the pattern to match member name. */ public void assertMemberMatches( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern, @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String memberNamePattern ) { assertMemberMatches( Pattern.compile( "^" + classNamePattern + "$" ), Pattern.compile( "^" + memberNamePattern + "$" ) ); }
/** * Verify that a symbol is either present or not present based on present parameter. * * @param classNamePattern the pattern to match className. * @param present true if member is expected to be present, false otherwise. */ public void assertSymbol( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern, final boolean present ) { assertSymbol( Pattern.compile( "^" + classNamePattern + "$" ), present ); }
/** * Find symbols by classname pattern and member pattern. * * @param classNamePattern the pattern to match className. * @param memberNamePattern the pattern to match member name. * @return the SymbolEntry instances that match. */ @Nonnull public List<SymbolEntry> findSymbolsByPatterns( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern, @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String memberNamePattern ) { return findSymbolsByPatterns( Pattern.compile( "^" + classNamePattern + "$" ), Pattern.compile( "^" + memberNamePattern + "$" ) ); }
/** * Verify at least one entry for ClassName exists in index. * If no matches are found then fail assertion error. * * @param classNamePattern the pattern */ public void assertClassNameMatches( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern ) { assertClassNameMatches( Pattern.compile( "^" + classNamePattern + "$" ) ); }
/** * Verify that either a member that matches patterns is either present or not present based on present parameter. * * @param classNamePattern the pattern to match className. * @param memberNamePattern the pattern to match member name. * @param present true if member is expected to be present, false otherwise. */ public void assertSymbol( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern, @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String memberNamePattern, final boolean present ) { assertSymbol( Pattern.compile( "^" + classNamePattern + "$" ), Pattern.compile( "^" + memberNamePattern + "$" ), present ); }
/** * Verify no entry for ClassName exists in index. * If a match is found then fail assertion error. * * @param classNamePattern the pattern */ public void assertNoClassNameMatches( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern ) { assertNoClassNameMatches( Pattern.compile( "^" + classNamePattern + "$" ) ); }
/** * Find symbols by classname pattern and member pattern. * * @param classNamePattern the pattern to match className. * @return the SymbolEntry instances that match. */ @Nonnull public List<SymbolEntry> findSymbolsByClassName( @RegExp( prefix = "^", suffix = "$" ) @Nonnull final String classNamePattern ) { return findSymbolsByClassName( Pattern.compile( "^" + classNamePattern + "$" ) ); }