@Test public void mathcingUris(){ final Path path = new Path("EMIR1/EMIR2/*/#"); final Uri uri = Uri.parse("http: final Uri uri1 = Uri.parse("http: final Uri uri2 = Uri.parse("http: assertThat(path.matches(uri)).isTrue(); assertThat(path.matches(uri1)).isFalse(); assertThat(path.matches(uri2)).isFalse(); }
public boolean matches(final Uri uri) { if (uri == null){ return false; } final List<String> pathSegments = uri.getPathSegments(); if (mPathSegments.size() != pathSegments.size()){ return false; } for (int index = 0; index < mPathSegments.size(); index++){ final String incomingPathSegment = pathSegments.get(index); final String internalPathSegment = mPathSegments.get(index); if (internalPathSegment.equals("#")) { if (!isNumeric(incomingPathSegment)) { return false; } } else if (!internalPathSegment.equals("*") && !internalPathSegment.equals(incomingPathSegment)){ return false; } } return true; }
Path { public boolean matches(final Uri uri) { if (uri == null){ return false; } final List<String> pathSegments = uri.getPathSegments(); if (mPathSegments.size() != pathSegments.size()){ return false; } for (int index = 0; index < mPathSegments.size(); index++){ final String incomingPathSegment = pathSegments.get(index); final String internalPathSegment = mPathSegments.get(index); if (internalPathSegment.equals("#")) { if (!isNumeric(incomingPathSegment)) { return false; } } else if (!internalPathSegment.equals("*") && !internalPathSegment.equals(incomingPathSegment)){ return false; } } return true; } }
Path { public boolean matches(final Uri uri) { if (uri == null){ return false; } final List<String> pathSegments = uri.getPathSegments(); if (mPathSegments.size() != pathSegments.size()){ return false; } for (int index = 0; index < mPathSegments.size(); index++){ final String incomingPathSegment = pathSegments.get(index); final String internalPathSegment = mPathSegments.get(index); if (internalPathSegment.equals("#")) { if (!isNumeric(incomingPathSegment)) { return false; } } else if (!internalPathSegment.equals("*") && !internalPathSegment.equals(incomingPathSegment)){ return false; } } return true; } Path(final String path);  Path(final String... pathSegments); }
Path { public boolean matches(final Uri uri) { if (uri == null){ return false; } final List<String> pathSegments = uri.getPathSegments(); if (mPathSegments.size() != pathSegments.size()){ return false; } for (int index = 0; index < mPathSegments.size(); index++){ final String incomingPathSegment = pathSegments.get(index); final String internalPathSegment = mPathSegments.get(index); if (internalPathSegment.equals("#")) { if (!isNumeric(incomingPathSegment)) { return false; } } else if (!internalPathSegment.equals("*") && !internalPathSegment.equals(incomingPathSegment)){ return false; } } return true; } Path(final String path);  Path(final String... pathSegments); int getPathSegmentCount(); String getMatcherPath(); List<String> getPathSegments(final Object... objects); String getPath(final Object... objects); @Override boolean equals(final Object object); boolean matches(final Uri uri); }
Path { public boolean matches(final Uri uri) { if (uri == null){ return false; } final List<String> pathSegments = uri.getPathSegments(); if (mPathSegments.size() != pathSegments.size()){ return false; } for (int index = 0; index < mPathSegments.size(); index++){ final String incomingPathSegment = pathSegments.get(index); final String internalPathSegment = mPathSegments.get(index); if (internalPathSegment.equals("#")) { if (!isNumeric(incomingPathSegment)) { return false; } } else if (!internalPathSegment.equals("*") && !internalPathSegment.equals(incomingPathSegment)){ return false; } } return true; } Path(final String path);  Path(final String... pathSegments); int getPathSegmentCount(); String getMatcherPath(); List<String> getPathSegments(final Object... objects); String getPath(final Object... objects); @Override boolean equals(final Object object); boolean matches(final Uri uri);  }