Top Description Fields Constructors Methods
org.glassfish.tyrus.core.uri

public Class Match

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Set, java.util.logging.Level, .Logger, org.glassfish.tyrus.core.DebugContext, .TyrusEndpointWrapper, org.glassfish.tyrus.core.uri.internal.PathSegment, .UriComponent

Defines a match on an endpoint. The match is either exact, or is not exact. If the match is not exact, it means that some of the path segments on the endpoint are variables. In this case, the Match object carries the indices of the variable segments in the endpoint path, the map of the parameter names and values.
Author
dannycoward

Field Summary

Modifier and TypeField and Description
private final TyrusEndpointWrapper
private static final Logger
private final Map<String, String>
private final List<Integer>

Constructor Summary

AccessConstructor and Description
private
Match(TyrusEndpointWrapper endpointWrapper)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addParameter(String
parameter name.
name
,
String
parameter value.
value
,
int
parameter index.
index
)

Add new parameter.

private static List<String>
asEquivalenceList(String path)

Decodes the path and replaces all variables with {x}.

public static List<Match>

Returns:

a list of all endpoints with path matching the request path. The endpoints are in order of match preference, best match first.
getAllMatches
(String
request path.
requestPath
,
Set<TyrusEndpointWrapper>
endpoints.
endpoints
,
DebugContext
debug context.
debugContext
)

Return a list of all endpoints with path matching the request path.

public TyrusEndpointWrapper

Returns:

endpoint wrapper.
getEndpointWrapper
()

Get endpoint wrapper.

pack-priv int

Returns:

the index of the left most path variable.
getLowestVariableSegmentIndex
()

Get the index of the left most path variable.

public Map<String, String>

Returns:

map of parameter names-value pairs.
getParameters
()

Get map of parameter names-value pairs.

private static String
pack-priv List<Integer>

Returns:

list of variable segment indices.
getVariableSegmentIndices
()

Get variable segment indices (indexes).

public static boolean

Returns:

true when provided path are equivalent, false otherwise.
isEquivalent
(String
path to be checked.
path1
,
String
path to be checked.
path2
)

Check for equivalent paths.

pack-priv boolean

Returns:

true if the path of the matched endpoint does not contain any variables, false otherwise.
isExact
()

true if the path of the matched endpoint does not contain any variables, false otherwise.

private static boolean
isVariable(String segment)

private static Match
matchPath(String requestPath, TyrusEndpointWrapper endpoint, DebugContext debugContext)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

endpointWrapperback to summary
private final TyrusEndpointWrapper endpointWrapper
LOGGERback to summary
private static final Logger LOGGER
parametersback to summary
private final Map<String, String> parameters
variableSegmentIndicesback to summary
private final List<Integer> variableSegmentIndices

Constructor Detail

Matchback to summary
private Match(TyrusEndpointWrapper endpointWrapper)

Constructor.

Parameters
endpointWrapper:TyrusEndpointWrapper

TyrusEndpointWrapper instance.

Method Detail

addParameterback to summary
pack-priv void addParameter(String name, String value, int index)

Add new parameter.

Parameters
name:String

parameter name.

value:String

parameter value.

index:int

parameter index.

asEquivalenceListback to summary
private static List<String> asEquivalenceList(String path)

Decodes the path and replaces all variables with {x}.

getAllMatchesback to summary
public static List<Match> getAllMatches(String requestPath, Set<TyrusEndpointWrapper> endpoints, DebugContext debugContext)

Return a list of all endpoints with path matching the request path. The endpoints are in order of match preference, best match first.

Parameters
requestPath:String

request path.

endpoints:Set<TyrusEndpointWrapper>

endpoints.

debugContext:DebugContext

debug context.

Returns:List<Match>

a list of all endpoints with path matching the request path. The endpoints are in order of match preference, best match first.

getEndpointWrapperback to summary
public TyrusEndpointWrapper getEndpointWrapper()

Get endpoint wrapper.

Returns:TyrusEndpointWrapper

endpoint wrapper.

getLowestVariableSegmentIndexback to summary
pack-priv int getLowestVariableSegmentIndex()

Get the index of the left most path variable.

Returns:int

the index of the left most path variable.

getParametersback to summary
public Map<String, String> getParameters()

Get map of parameter names-value pairs.

Returns:Map<String, String>

map of parameter names-value pairs.

getVariableNameback to summary
private static String getVariableName(String segment)
getVariableSegmentIndicesback to summary
pack-priv List<Integer> getVariableSegmentIndices()

Get variable segment indices (indexes).

Returns:List<Integer>

list of variable segment indices.

isEquivalentback to summary
public static boolean isEquivalent(String path1, String path2)

Check for equivalent paths.

Parameters
path1:String

path to be checked.

path2:String

path to be checked.

Returns:boolean

true when provided path are equivalent, false otherwise.

isExactback to summary
pack-priv boolean isExact()

true if the path of the matched endpoint does not contain any variables, false otherwise.

Returns:boolean

true if the path of the matched endpoint does not contain any variables, false otherwise.

isVariableback to summary
private static boolean isVariable(String segment)
matchPathback to summary
private static Match matchPath(String requestPath, TyrusEndpointWrapper endpoint, DebugContext debugContext)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override