public class TemplateRequestURLBuilder extends Object implements com.google.common.base.Function<String,String>
The entity ID will be replaced in the template string according to the template variable entityID
,
e.g. "https://metadataservice.com/entity/${entityID}".
If the value of the encoded
parameter is true
then the entity ID will be URL encoded prior
to substitution. Otherwise, the literal value of the entity ID will be substituted.
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_KEY_ENTITY_ID
The Velocity context variable name for the entity ID.
|
Constructor and Description |
---|
TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine,
String templateString,
boolean encoded)
Constructor.
|
TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine,
String templateString,
boolean encoded,
com.google.common.base.Function<String,String> transform)
Constructor.
|
TemplateRequestURLBuilder(org.apache.velocity.app.VelocityEngine engine,
String templateString,
boolean encoded,
com.google.common.base.Function<String,String> transform,
Charset charSet)
Constructor.
|
public static final String CONTEXT_KEY_ENTITY_ID
public TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, boolean encoded)
The template character set will be US ASCII.
engine
- the VelocityEngine
instance to usetemplateString
- the Velocity template stringencoded
- true if entity ID should be URL-encoded prior to substitution, false otherwisepublic TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, boolean encoded, @Nullable com.google.common.base.Function<String,String> transform)
The template character set will be US ASCII.
engine
- the VelocityEngine
instance to usetemplateString
- the Velocity template stringtransform
- function which transforms the entityID prior to substitution, may be nullencoded
- true if entity ID should be URL-encoded prior to substitution, false otherwisepublic TemplateRequestURLBuilder(@Nonnull org.apache.velocity.app.VelocityEngine engine, @Nonnull @NotEmpty String templateString, boolean encoded, @Nullable com.google.common.base.Function<String,String> transform, @Nullable Charset charSet)
engine
- the VelocityEngine
instance to usetemplateString
- the Velocity template stringencoded
- true if entity ID should be URL-encoded prior to substitution, false otherwisetransform
- function which transforms the entityID prior to substitution, may be nullcharSet
- character set of the template, may be nullCopyright © 2016 JBoss by Red Hat. All rights reserved.