Issue #8628 - pseudo restore PathMappings.getMatch(String)

+ This returns a MappedResource, but not
  the stored instance, but a new instance
  of MappedResource every time.

+ Flagged deprecated APIs for removal
  as well

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2022-09-28 11:25:16 -05:00
parent 3c35b2dce4
commit 3faa2fcd16
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 4 additions and 3 deletions

View File

@ -256,10 +256,11 @@ public class PathMappings<E> implements Iterable<MappedResource<E>>, Dumpable
/**
* @deprecated use {@link #getMatched(String)} instead
*/
@Deprecated
@Deprecated(forRemoval = true)
public MappedResource<E> getMatch(String path)
{
throw new UnsupportedOperationException("Use .getMatched(String) instead");
MatchedResource<E> matchedPath = getMatched(path);
return new MappedResource<>(matchedPath.getPathSpec(), matchedPath.getResource());
}
@Override
@ -271,7 +272,7 @@ public class PathMappings<E> implements Iterable<MappedResource<E>>, Dumpable
/**
* @deprecated use {@link PathSpec#from(String)} instead
*/
@Deprecated
@Deprecated(forRemoval = true)
public static PathSpec asPathSpec(String pathSpecString)
{
return PathSpec.from(pathSpecString);