Author: svenmeier
Date: Tue Jul 19 18:33:44 2011
New Revision: 1148476
URL: http://svn.apache.org/viewvc?rev=1148476&view=rev
Log:
minor renamings in javadoc and local variables (encoder/mapper)
Modified:
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/IRequestMapper.java
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/ICompoundRequestMapper.java
Modified:
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/IRequestMapper.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/IRequestMapper.java?rev=1148476&r1=1148475&r2=1148476&view=diff
==============================================================================
---
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/IRequestMapper.java
(original)
+++
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/IRequestMapper.java
Tue Jul 19 18:33:44 2011
@@ -18,18 +18,18 @@ package org.apache.wicket.request;
/**
- * Encodes {@link IRequestHandler}(s) into {@link Url}(s) and decodes {@link
Request}(s) to
+ * Maps {@link IRequestHandler}(s) into {@link Url}(s) and {@link Request}(s)
to
* {@link IRequestHandler}(s). For {@link IRequestHandler}s and {@link
Request}s the implementation
- * doesn't know the {@link #mapHandler(IRequestHandler)} and {@link
#mapRequest(Request)} methods
- * must return <code>null</code>.
+ * doesn't recognize, the {@link #mapHandler(IRequestHandler)} and {@link
#mapRequest(Request)}
+ * methods must return {@code null}.
*
* @author Matej Knopp
*/
public interface IRequestMapper
{
/**
- * Returns {@link IRequestHandler} for the request or <code>null</code>
if the encoder does not
- * recognize the URL.
+ * Returns {@link IRequestHandler} for the request or <code>null</code>
if the {@link Url} is
+ * not recognized.
*
* @param request
* provides access to request data (i.e. Url and Parameters)
@@ -44,22 +44,22 @@ public interface IRequestMapper
* score to lowest.
* <p>
* A good criteria for calculating the score is the number of matched
url segments. For example
- * when there are two encoders for mounted page, one mapped to
<code>/foo</code> another to
- * <code>/foo/bar</code> and the incoming request URL is
</code>/foo/bar/baz</code>, the encoder
- * mapped to <code>/foo/bar</code> will handle the request first as it
has matching segments
+ * when there are two mappers for a mounted page, one mapped to
<code>/foo</code> another to
+ * <code>/foo/bar</code> and the incoming request URL is
</code>/foo/bar/baz</code>, the mapping
+ * to <code>/foo/bar</code> should probably handle the request first as
it has matching segments
* count of 2 while the first one has only matching segments count of 1.
* <p>
- * Note that the method can return value greater then zero even if the
encoder can not decode
+ * Note that the method can return value greater then zero even if the
mapper does not recognize
* the request.
*
* @param request
- * @return count of matching segments
+ * @return the compatibility score, e.g. count of matching segments
*/
int getCompatibilityScore(Request request);
/**
- * Returns the {@link Url} for given {@link IRequestHandler} or
<code>null</code> if the encoder
- * does not recognize the request handler.
+ * Returns the {@link Url} for given {@link IRequestHandler} or
<code>null</code> if the request
+ * handler is not recognized.
*
* @param requestHandler
* @return Url instance or <code>null</code>.
Modified:
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java?rev=1148476&r1=1148475&r2=1148476&view=diff
==============================================================================
---
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java
(original)
+++
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/CompoundRequestMapper.java
Tue Jul 19 18:33:44 2011
@@ -43,18 +43,18 @@ public class CompoundRequestMapper imple
/**
*
*/
- private static class EncoderWithSegmentsCount implements
Comparable<EncoderWithSegmentsCount>
+ private static class MapperWithScore implements
Comparable<MapperWithScore>
{
private final IRequestMapper mapper;
private final int compatibilityScore;
- public EncoderWithSegmentsCount(final IRequestMapper encoder,
final int compatibilityScore)
+ public MapperWithScore(final IRequestMapper mapper, final int
compatibilityScore)
{
- mapper = encoder;
+ this.mapper = mapper;
this.compatibilityScore = compatibilityScore;
}
- public int compareTo(final EncoderWithSegmentsCount o)
+ public int compareTo(final MapperWithScore o)
{
return o.compatibilityScore - compatibilityScore;
}
@@ -86,49 +86,48 @@ public class CompoundRequestMapper imple
/**
* @see
org.apache.wicket.request.mapper.ICompoundRequestMapper#add(org.apache.wicket.request.IRequestMapper)
*/
- public CompoundRequestMapper add(final IRequestMapper encoder)
+ public CompoundRequestMapper add(final IRequestMapper mapper)
{
- mappers.add(0, encoder);
+ mappers.add(0, mapper);
return this;
}
/**
* @see
org.apache.wicket.request.mapper.ICompoundRequestMapper#remove(org.apache.wicket.request.IRequestMapper)
*/
- public CompoundRequestMapper remove(final IRequestMapper encoder)
+ public CompoundRequestMapper remove(final IRequestMapper mapper)
{
- mappers.remove(encoder);
+ mappers.remove(mapper);
return this;
}
/**
- * Searches the registered {@link IRequestMapper}s to find one that can
decode the
- * {@link Request}. Each registered {@link IRequestMapper} is asked to
provide the matching
- * segments count. Then the encoders are asked to decode the request in
order depending on the
- * provided segments count.
+ * Searches the registered {@link IRequestMapper}s to find one that can
map the {@link Request}.
+ * Each registered {@link IRequestMapper} is asked to provide its
compatibility score. Then the
+ * mappers are asked to map the request in order depending on the
provided compatibility
+ * score.
* <p>
- * The encoder with highest matching segments count that can decode the
request is returned.
+ * The mapper with highest compatibility score which can map the
request is returned.
*
* @param request
- * @return RequestHandler for the request or <code>null</code> if no
encoder for the request is
+ * @return RequestHandler for the request or <code>null</code> if no
mapper for the request is
* found.
*/
public IRequestHandler mapRequest(final Request request)
{
- List<EncoderWithSegmentsCount> list = new
ArrayList<EncoderWithSegmentsCount>(
- mappers.size());
+ List<MapperWithScore> list = new
ArrayList<MapperWithScore>(mappers.size());
- for (IRequestMapper encoder : mappers)
+ for (IRequestMapper mapper : mappers)
{
- int score = encoder.getCompatibilityScore(request);
- list.add(new EncoderWithSegmentsCount(encoder, score));
+ int score = mapper.getCompatibilityScore(request);
+ list.add(new MapperWithScore(mapper, score));
}
Collections.sort(list);
- for (EncoderWithSegmentsCount encoder : list)
+ for (MapperWithScore mapperWithScore : list)
{
- IRequestHandler handler =
encoder.getMapper().mapRequest(request);
+ IRequestHandler handler =
mapperWithScore.getMapper().mapRequest(request);
if (handler != null)
{
return handler;
@@ -139,22 +138,22 @@ public class CompoundRequestMapper imple
}
/**
- * Searches the registered {@link IRequestMapper}s to find one that can
encode the
- * {@link IRequestHandler}. Each registered {@link IRequestMapper} is
asked to encode the
- * {@link IRequestHandler} until an encoder that can encode the {@link
IRequestHandler} is found
- * or no more encoders are left.
+ * Searches the registered {@link IRequestMapper}s to find one that can
map the
+ * {@link IRequestHandler}. Each registered {@link IRequestMapper} is
asked to map the
+ * {@link IRequestHandler} until a mapper which can map the {@link
IRequestHandler} is found or
+ * no more mappers are left.
* <p>
- * The handlers are searched in reverse order as they have been
registered. More recently
- * registered handlers have bigger priority.
+ * The mappers are searched in reverse order as they have been
registered. More recently
+ * registered mappers have bigger priority.
*
* @param handler
- * @return Url for the handler or <code>null</code> if no encoder for
the handler is found.
+ * @return Url for the handler or <code>null</code> if no mapper for
the handler is found.
*/
public Url mapHandler(final IRequestHandler handler)
{
- for (IRequestMapper encoder : mappers)
+ for (IRequestMapper mapper : mappers)
{
- Url url = encoder.mapHandler(handler);
+ Url url = mapper.mapHandler(handler);
if (url != null)
{
return url;
Modified:
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/ICompoundRequestMapper.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/ICompoundRequestMapper.java?rev=1148476&r1=1148475&r2=1148476&view=diff
==============================================================================
---
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/ICompoundRequestMapper.java
(original)
+++
wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/ICompoundRequestMapper.java
Tue Jul 19 18:33:44 2011
@@ -29,18 +29,18 @@ public interface ICompoundRequestMapper
/**
* Registers a {@link IRequestMapper}
*
- * @param encoder
+ * @param mapper
* @return {@code this} for chaining
*/
- ICompoundRequestMapper add(IRequestMapper encoder);
+ ICompoundRequestMapper add(IRequestMapper mapper);
/**
- * Unregisters {@link IRequestMapper}
+ * Unregisters a {@link IRequestMapper}
*
- * @param encoder
+ * @param mapper
* @return {@code this} for chaining
*/
- ICompoundRequestMapper remove(IRequestMapper encoder);
+ ICompoundRequestMapper remove(IRequestMapper mapper);
/**
* Unregisters all {@link IRequestMapper}s which would match on a this
path