http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java index 2db986e..3c71cf9 100644 --- a/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java +++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RemoteableMethodMeta.java @@ -26,7 +26,8 @@ import java.util.*; * * <h6 class='topic'>Additional Information</h6> * <ul class='doctree'> - * <li class='link'><a class='doclink' href='../../../../overview-summary.html#Remoteable.3rdParty'>Interface proxies against 3rd-party REST interfaces</a> + * <li class='link'><a class='doclink' href='../../../../overview-summary.html#Remoteable.3rdParty'>Interface + * proxies against 3rd-party REST interfaces</a> * <li class='jp'><a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.remoteable</a> * </ul> */ @@ -78,13 +79,15 @@ public class RemoteableMethodMeta { httpMethod = rm == null ? "POST" : rm.httpMethod(); if (! isOneOf(httpMethod, "DELETE", "GET", "POST", "PUT")) - throw new RemoteableMetadataException(m, "Invalid value specified for @RemoteMethod.httpMethod() annotation. Valid values are [DELTE,GET,POST,PUT]."); + throw new RemoteableMetadataException(m, + "Invalid value specified for @RemoteMethod.httpMethod() annotation. Valid values are [DELTE,GET,POST,PUT]."); String path = rm == null || rm.path().isEmpty() ? null : rm.path(); String methodPaths = r == null ? "NAME" : r.methodPaths(); if (! isOneOf(methodPaths, "NAME", "SIGNATURE")) - throw new RemoteableMetadataException(m, "Invalid value specified for @Remoteable.methodPaths() annotation. Valid values are [NAME,SIGNATURE]."); + throw new RemoteableMetadataException(m, + "Invalid value specified for @Remoteable.methodPaths() annotation. Valid values are [NAME,SIGNATURE]."); returnValue = rm == null ? ReturnValue.BODY : rm.returns(); @@ -127,7 +130,8 @@ public class RemoteableMethodMeta { if (bodyArg == null) bodyArg = index; else - throw new RemoteableMetadataException(m, "Multiple @Body parameters found. Only one can be specified per Java method."); + throw new RemoteableMetadataException(m, + "Multiple @Body parameters found. Only one can be specified per Java method."); } } if (! annotated) @@ -136,12 +140,14 @@ public class RemoteableMethodMeta { } if (bodyArg != null && otherArgs.size() > 0) - throw new RemoteableMetadataException(m, "@Body and non-annotated parameters found together. Non-annotated parameters cannot be used when @Body is used."); + throw new RemoteableMetadataException(m, + "@Body and non-annotated parameters found together. Non-annotated parameters cannot be used when @Body is used."); } } /** * Returns the value of the {@link RemoteMethod#httpMethod()} annotation on this Java method. + * * @return The value of the {@link RemoteMethod#httpMethod()} annotation, never <jk>null</jk>. */ public String getHttpMethod() { @@ -150,6 +156,7 @@ public class RemoteableMethodMeta { /** * Returns the absolute URL of the REST interface invoked by this Java method. + * * @return The absolute URL of the REST interface, never <jk>null</jk>. */ public String getUrl() { @@ -158,6 +165,7 @@ public class RemoteableMethodMeta { /** * Returns the {@link Path @Path} annotated arguments on this Java method. + * * @return A map of {@link Path#value() @Path.value()} names to zero-indexed argument indices. */ public RemoteMethodArg[] getPathArgs() { @@ -166,6 +174,7 @@ public class RemoteableMethodMeta { /** * Returns the {@link Query @Query} annotated arguments on this Java method. + * * @return A map of {@link Query#value() @Query.value()} names to zero-indexed argument indices. */ public RemoteMethodArg[] getQueryArgs() { @@ -174,6 +183,7 @@ public class RemoteableMethodMeta { /** * Returns the {@link FormData @FormData} annotated arguments on this Java method. + * * @return A map of {@link FormData#value() @FormData.value()} names to zero-indexed argument indices. */ public RemoteMethodArg[] getFormDataArgs() { @@ -182,6 +192,7 @@ public class RemoteableMethodMeta { /** * Returns the {@link Header @Header} annotated arguments on this Java method. + * * @return A map of {@link Header#value() @Header.value()} names to zero-indexed argument indices. */ public RemoteMethodArg[] getHeaderArgs() { @@ -190,6 +201,7 @@ public class RemoteableMethodMeta { /** * Returns the {@link RequestBean @RequestBean} annotated arguments on this Java method. + * * @return A list of zero-indexed argument indices. */ public RemoteMethodArg[] getRequestBeanArgs() { @@ -198,6 +210,7 @@ public class RemoteableMethodMeta { /** * Returns the remaining non-annotated arguments on this Java method. + * * @return A list of zero-indexed argument indices. */ public Integer[] getOtherArgs() { @@ -206,6 +219,7 @@ public class RemoteableMethodMeta { /** * Returns the argument annotated with {@link Body @Body}. + * * @return A index of the argument with the {@link Body @Body} annotation, or <jk>null</jk> if no argument exists. */ public Integer getBodyArg() { @@ -214,6 +228,7 @@ public class RemoteableMethodMeta { /** * Returns whether the method returns the HTTP response body or status code. + * * @return Whether the method returns the HTTP response body or status code. */ public ReturnValue getReturns() {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/remoteable/RequestBean.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/remoteable/RequestBean.java b/juneau-core/src/main/java/org/apache/juneau/remoteable/RequestBean.java index 76b4c4a..5c46a90 100644 --- a/juneau-core/src/main/java/org/apache/juneau/remoteable/RequestBean.java +++ b/juneau-core/src/main/java/org/apache/juneau/remoteable/RequestBean.java @@ -83,7 +83,8 @@ import org.apache.juneau.urlencoding.*; * * <h6 class='topic'>Additional Information</h6> * <ul class='doctree'> - * <li class='link'><a class='doclink' href='../../../../overview-summary.html#Remoteable.3rdParty'>Interface proxies against 3rd-party REST interfaces</a> + * <li class='link'><a class='doclink' href='../../../../overview-summary.html#Remoteable.3rdParty'>Interface + * proxies against 3rd-party REST interfaces</a> * <li class='jp'><a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.remoteable</a> * </ul> */ @@ -97,7 +98,7 @@ public @interface RequestBean { * Specifies the {@link PartSerializer} class used for serializing values to strings. * <p> * The default value defaults to the using the part serializer defined on the client which by default is - * {@link UrlEncodingSerializer}. + * {@link UrlEncodingSerializer}. * <p> * This annotation is provided to allow values to be custom serialized. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/OutputStreamSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/OutputStreamSerializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/OutputStreamSerializer.java index d751fdc..c181a02 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/OutputStreamSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/OutputStreamSerializer.java @@ -35,19 +35,20 @@ import org.apache.juneau.annotation.*; * The media types that this serializer can produce is specified through the {@link Produces @Produces} annotation. * <p> * However, the media types can also be specified programmatically by overriding the {@link #getMediaTypes()} - * and {@link #getResponseContentType()} methods. + * and {@link #getResponseContentType()} methods. */ public abstract class OutputStreamSerializer extends Serializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ protected OutputStreamSerializer(PropertyStore propertyStore) { super(propertyStore); } - @Override /* Serializer */ + @Override /* Serializer */ public boolean isWriterSerializer() { return false; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java index 655ec0c..70bbd4f 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/Serializer.java @@ -38,7 +38,7 @@ import org.apache.juneau.soap.*; * The media types that this serializer can produce is specified through the {@link Produces @Produces} annotation. * <p> * However, the media types can also be specified programmatically by overriding the {@link #getMediaTypes()} - * and {@link #getResponseContentType()} methods. + * and {@link #getResponseContentType()} methods. */ public abstract class Serializer extends CoreObject { @@ -85,10 +85,10 @@ public abstract class Serializer extends CoreObject { * Serializes a POJO to the specified output stream or writer. * <p> * This method should NOT close the context object. - * @param session The serializer session object return by {@link #createSession(Object, ObjectMap, Method, Locale, TimeZone, MediaType, UriContext)}.<br> + * @param session The serializer session object return by {@link #createSession(Object, ObjectMap, Method, Locale, + * TimeZone, MediaType, UriContext)}. * If <jk>null</jk>, session is created using {@link #createSession(Object)}. * @param o The object to serialize. - * * @throws Exception If thrown from underlying stream, or if the input contains a syntax error or is malformed. */ protected abstract void doSerialize(SerializerSession session, Object o) throws Exception; @@ -100,8 +100,8 @@ public abstract class Serializer extends CoreObject { * * @param o The object to serialize. * @return The serialized object. - * <br>Character-based serializers will return a <code>String</code> - * <br>Stream-based serializers will return a <code><jk>byte</jk>[]</code> + * <br>Character-based serializers will return a <code>String</code> + * <br>Stream-based serializers will return a <code><jk>byte</jk>[]</code> * @throws SerializeException If a problem occurred trying to convert the output. */ public abstract Object serialize(Object o) throws SerializeException; @@ -113,7 +113,8 @@ public abstract class Serializer extends CoreObject { /** * Serialize the specified object using the specified session. * - * @param session The serializer session object return by {@link #createSession(Object, ObjectMap, Method, Locale, TimeZone, MediaType, UriContext)}.<br> + * @param session The serializer session object return by {@link #createSession(Object, ObjectMap, Method, Locale, + * TimeZone, MediaType, UriContext)}. * If <jk>null</jk>, session is created using {@link #createSession(Object)}. * @param o The object to serialize. * @throws SerializeException If a problem occurred trying to convert the output. @@ -124,7 +125,8 @@ public abstract class Serializer extends CoreObject { } catch (SerializeException e) { throw e; } catch (StackOverflowError e) { - throw new SerializeException(session, "Stack overflow occurred. This can occur when trying to serialize models containing loops. It's recommended you use the SerializerContext.SERIALIZER_detectRecursions setting to help locate the loop.").initCause(e); + throw new SerializeException(session, + "Stack overflow occurred. This can occur when trying to serialize models containing loops. It's recommended you use the SerializerContext.SERIALIZER_detectRecursions setting to help locate the loop.").initCause(e); } catch (Exception e) { throw new SerializeException(session, e); } finally { @@ -139,17 +141,17 @@ public abstract class Serializer extends CoreObject { * * @param o The object to serialize. * @param output The output object. - * <br>Character-based serializers can handle the following output class types: - * <ul> - * <li>{@link Writer} - * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. - * <li>{@link File} - Output will be written as system-default encoded stream. - * </ul> - * <br>Stream-based serializers can handle the following output class types: - * <ul> - * <li>{@link OutputStream} - * <li>{@link File} - * </ul> + * <br>Character-based serializers can handle the following output class types: + * <ul> + * <li>{@link Writer} + * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. + * <li>{@link File} - Output will be written as system-default encoded stream. + * </ul> + * <br>Stream-based serializers can handle the following output class types: + * <ul> + * <li>{@link OutputStream} + * <li>{@link File} + * </ul> * @throws SerializeException If a problem occurred trying to convert the output. */ public final void serialize(Object o, Object output) throws SerializeException { @@ -160,21 +162,21 @@ public abstract class Serializer extends CoreObject { /** * Create the session object that will be passed in to the serialize method. * <p> - * It's up to implementers to decide what the session object looks like, although typically - * it's going to be a subclass of {@link SerializerSession}. + * It's up to implementers to decide what the session object looks like, although typically it's going to be a + * subclass of {@link SerializerSession}. * * @param output The output object. - * <br>Character-based serializers can handle the following output class types: - * <ul> - * <li>{@link Writer} - * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. - * <li>{@link File} - Output will be written as system-default encoded stream. - * </ul> - * <br>Stream-based serializers can handle the following output class types: - * <ul> - * <li>{@link OutputStream} - * <li>{@link File} - * </ul> + * <br>Character-based serializers can handle the following output class types: + * <ul> + * <li>{@link Writer} + * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. + * <li>{@link File} - Output will be written as system-default encoded stream. + * </ul> + * <br>Stream-based serializers can handle the following output class types: + * <ul> + * <li>{@link OutputStream} + * <li>{@link File} + * </ul> * @param op Optional additional properties. * @param javaMethod Java method that invoked this serializer. * When using the REST API, this is the Java method invoked by the REST call. @@ -188,7 +190,8 @@ public abstract class Serializer extends CoreObject { * Identifies the current request URI used for resolution of URIs to absolute or root-relative form. * @return The new session. */ - public SerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, UriContext uriContext) { + public SerializerSession createSession(Object output, ObjectMap op, Method javaMethod, Locale locale, + TimeZone timeZone, MediaType mediaType, UriContext uriContext) { return new SerializerSession(ctx, op, output, javaMethod, locale, timeZone, mediaType, uriContext); } @@ -198,17 +201,17 @@ public abstract class Serializer extends CoreObject { * Equivalent to calling <code>createSession(<jk>null</jk>, <jk>null</jk>)</code>. * * @param output The output object. - * <br>Character-based serializers can handle the following output class types: - * <ul> - * <li>{@link Writer} - * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. - * <li>{@link File} - Output will be written as system-default encoded stream. - * </ul> - * <br>Stream-based serializers can handle the following output class types: - * <ul> - * <li>{@link OutputStream} - * <li>{@link File} - * </ul> + * <br>Character-based serializers can handle the following output class types: + * <ul> + * <li>{@link Writer} + * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. + * <li>{@link File} - Output will be written as system-default encoded stream. + * </ul> + * <br>Stream-based serializers can handle the following output class types: + * <ul> + * <li>{@link OutputStream} + * <li>{@link File} + * </ul> * @return The new session. */ protected SerializerSession createSession(Object output) { @@ -220,9 +223,9 @@ public abstract class Serializer extends CoreObject { * <p> * Works on both object and primitive arrays. * <p> - * In the case of multi-dimensional arrays, the outgoing list will - * contain elements of type n-1 dimension. i.e. if {@code type} is <code><jk>int</jk>[][]</code> - * then {@code list} will have entries of type <code><jk>int</jk>[]</code>. + * In the case of multi-dimensional arrays, the outgoing list will contain elements of type n-1 dimension. + * i.e. if {@code type} is <code><jk>int</jk>[][]</code> then {@code list} will have entries of type + * <code><jk>int</jk>[]</code>. * * @param type The type of array. * @param array The array being converted. @@ -243,7 +246,7 @@ public abstract class Serializer extends CoreObject { /** * Returns the media types handled based on the value of the {@link Produces} annotation on the serializer class. * <p> - * This method can be overridden by subclasses to determine the media types programatically. + * This method can be overridden by subclasses to determine the media types programmatically. * * @return The list of media types. Never <jk>null</jk>. */ @@ -265,9 +268,11 @@ public abstract class Serializer extends CoreObject { * <p> * For example, {@link SoapXmlSerializer} needs to set a <code>SOAPAction</code> header. * <p> - * This method is typically meaningless if the serializer is being used standalone (i.e. outside of a REST server or client). + * This method is typically meaningless if the serializer is being used stand-alone (i.e. outside of a REST server + * or client). * - * @param properties Optional run-time properties (the same that are passed to {@link WriterSerializer#doSerialize(SerializerSession, Object)}. + * @param properties Optional run-time properties (the same that are passed to + * {@link WriterSerializer#doSerialize(SerializerSession, Object)}. * Can be <jk>null</jk>. * @return The HTTP headers to set on HTTP requests. * Can be <jk>null</jk>. @@ -277,14 +282,16 @@ public abstract class Serializer extends CoreObject { } /** - * Optional method that returns the response <code>Content-Type</code> for this serializer if it is different from the matched media type. + * Optional method that returns the response <code>Content-Type</code> for this serializer if it is different from + * the matched media type. * <p> * This method is specified to override the content type for this serializer. - * For example, the {@link org.apache.juneau.json.JsonSerializer.Simple} class returns that it handles media type <js>"text/json+simple"</js>, but returns - * <js>"text/json"</js> as the actual content type. + * For example, the {@link org.apache.juneau.json.JsonSerializer.Simple} class returns that it handles media type + * <js>"text/json+simple"</js>, but returns <js>"text/json"</js> as the actual content type. * This allows clients to request specific 'flavors' of content using specialized <code>Accept</code> header values. * <p> - * This method is typically meaningless if the serializer is being used standalone (i.e. outside of a REST server or client). + * This method is typically meaningless if the serializer is being used stand-alone (i.e. outside of a REST server + * or client). * * @return The response content type. If <jk>null</jk>, then the matched media type is used. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java index 3a7ec4f..489a01c 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerBuilder.java @@ -34,6 +34,7 @@ public class SerializerBuilder extends CoreObjectBuilder { /** * Constructor. + * * @param propertyStore The initial configuration settings for this builder. */ public SerializerBuilder(PropertyStore propertyStore) { @@ -117,11 +118,12 @@ public class SerializerBuilder extends CoreObjectBuilder { * <p> * Recursions can occur when serializing models that aren't true trees, but rather contain loops. * <p> - * The behavior when recursions are detected depends on the value for {@link SerializerContext#SERIALIZER_ignoreRecursions}. + * The behavior when recursions are detected depends on the value for + * {@link SerializerContext#SERIALIZER_ignoreRecursions}. * <p> * For example, if a model contains the links A->B->C->A, then the JSON generated will look like - * the following when <jsf>SERIALIZER_ignoreRecursions</jsf> is <jk>true</jk>... - * <code>{A:{B:{C:null}}}</code><br> + * the following when <jsf>SERIALIZER_ignoreRecursions</jsf> is <jk>true</jk>... + * <code>{A:{B:{C:null}}}</code> * <p> * <h5 class='section'>Notes:</h5> * <ul> @@ -237,9 +239,11 @@ public class SerializerBuilder extends CoreObjectBuilder { * <li><b>Session-overridable:</b> <jk>true</jk> * </ul> * <p> - * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred through reflection. + * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred + * through reflection. * This is used to recreate the correct objects during parsing if the object types cannot be inferred. - * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from the value type. + * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from + * the value type. * <p> * <h5 class='section'>Notes:</h5> * <ul> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java index da53f8f..f316fac 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerContext.java @@ -69,7 +69,7 @@ public class SerializerContext extends BeanContext { * <p> * For example, if a model contains the links A->B->C->A, then the JSON generated will look like * the following when <jsf>SERIALIZER_ignoreRecursions</jsf> is <jk>true</jk>... - * <code>{A:{B:{C:null}}}</code><br> + * <code>{A:{B:{C:null}}}</code> * <p> * <h5 class='section'>Notes:</h5> * <ul> @@ -139,9 +139,11 @@ public class SerializerContext extends BeanContext { * <li><b>Session-overridable:</b> <jk>true</jk> * </ul> * <p> - * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred through reflection. + * If <jk>true</jk>, then <js>"_type"</js> properties will be added to beans if their type cannot be inferred + * through reflection. * This is used to recreate the correct objects during parsing if the object types cannot be inferred. - * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from the value type. + * For example, when serializing a {@code Map<String,Object>} field, where the bean class cannot be determined from + * the value type. */ public static final String SERIALIZER_addBeanTypeProperties = "Serializer.addBeanTypeProperties"; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java index 5a4db6e..0c1cf0e 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroup.java @@ -76,8 +76,8 @@ public final class SerializerGroup { * @param propertyStore The modifiable properties that were used to initialize the serializers. * A snapshot of these will be made so that we can clone and modify this group. * @param serializers The serializers defined in this group. - * The order is important because they will be tried in reverse order (e.g. - * newer first) in which they will be tried to match against media types. + * The order is important because they will be tried in reverse order (e.g.newer first) in which they will be tried + * to match against media types. */ public SerializerGroup(PropertyStore propertyStore, Serializer[] serializers) { this.propertyStore = PropertyStore.create(propertyStore); @@ -114,8 +114,9 @@ public final class SerializerGroup { * accept-extension = ";" token [ "=" ( token | quoted-string ) ] * </p> * <p> - * The general idea behind having the serializer resolution be a two-step process is so that - * the matched media type can be passed in to the {@link WriterSerializer#doSerialize(SerializerSession, Object)} method. + * The general idea behind having the serializer resolution be a two-step process is so that the matched media type + * can be passed in to the {@link WriterSerializer#doSerialize(SerializerSession, Object)} method. + * <br> * For example... * <p class='bcode'> * String acceptHeaderValue = request.getHeader(<js>"Accept"</js>); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java index a29449b..9636597 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerGroupBuilder.java @@ -52,6 +52,7 @@ public class SerializerGroupBuilder { /** * Clone an existing serializer group builder. + * * @param copyFrom The serializer group that we're copying settings and serializers from. */ public SerializerGroupBuilder(SerializerGroup copyFrom) { @@ -1114,8 +1115,8 @@ public class SerializerGroupBuilder { /** * Specifies the classloader to use when resolving classes from strings for all serializers in this group. * <p> - * Can be used for resolving class names when the classes being created are in a different - * classloader from the Juneau code. + * Can be used for resolving class names when the classes being created are in a different classloader from the + * Juneau code. * <p> * If <jk>null</jk>, the system classloader will be used to resolve classes. * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerListener.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerListener.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerListener.java index 50b967c..caa0bbb 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerListener.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerListener.java @@ -25,12 +25,12 @@ public class SerializerListener { * Called when an exception is thrown when trying to call a bean getter method. * * @param session The serializer session. - * Note that if * @param t The throwable that was thrown by the getter method. * @param p The bean property we had an issue on. */ public void onBeanGetterException(SerializerSession session, Throwable t, BeanPropertyMeta p) { - onError(session, t, format("Could not call getValue() on property ''{0}'' of class ''{1}'', exception = {2}", p.getName(), p.getBeanMeta().getClassMeta(), t.getLocalizedMessage())); + onError(session, t, format("Could not call getValue() on property ''{0}'' of class ''{1}'', exception = {2}", + p.getName(), p.getBeanMeta().getClassMeta(), t.getLocalizedMessage())); } /** http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java index 357ccd2..80aa351 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerSession.java @@ -76,31 +76,32 @@ public class SerializerSession extends BeanSession { * Create a new session using properties specified in the context. * * @param ctx The context creating this session object. - * The context contains all the configuration settings for this object. + * The context contains all the configuration settings for this object. * @param output The output object. - * <br>Character-based serializers can handle the following output class types: - * <ul> - * <li>{@link Writer} - * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. - * <li>{@link File} - Output will be written as system-default encoded stream. - * </ul> - * <br>Stream-based serializers can handle the following output class types: - * <ul> - * <li>{@link OutputStream} - * <li>{@link File} - * </ul> + * <br>Character-based serializers can handle the following output class types: + * <ul> + * <li>{@link Writer} + * <li>{@link OutputStream} - Output will be written as UTF-8 encoded stream. + * <li>{@link File} - Output will be written as system-default encoded stream. + * </ul> + * <br>Stream-based serializers can handle the following output class types: + * <ul> + * <li>{@link OutputStream} + * <li>{@link File} + * </ul> * @param op The override properties. - * These override any context properties defined in the context. + * These override any context properties defined in the context. * @param javaMethod The java method that called this serializer, usually the method in a REST servlet. * @param locale The session locale. - * If <jk>null</jk>, then the locale defined on the context is used. + * If <jk>null</jk>, then the locale defined on the context is used. * @param timeZone The session timezone. - * If <jk>null</jk>, then the timezone defined on the context is used. + * If <jk>null</jk>, then the timezone defined on the context is used. * @param mediaType The session media type (e.g. <js>"application/json"</js>). * @param uriContext The URI context. - * Identifies the current request URI used for resolution of URIs to absolute or root-relative form. + * Identifies the current request URI used for resolution of URIs to absolute or root-relative form. */ - public SerializerSession(SerializerContext ctx, ObjectMap op, Object output, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, UriContext uriContext) { + public SerializerSession(SerializerContext ctx, ObjectMap op, Object output, Method javaMethod, Locale locale, + TimeZone timeZone, MediaType mediaType, UriContext uriContext) { super(ctx, op, locale, timeZone, mediaType); this.javaMethod = javaMethod; this.output = output; @@ -229,6 +230,7 @@ public class SerializerSession extends BeanSession { /** * Sets the current bean property being serialized for proper error messages. + * * @param currentProperty The current property being serialized. */ public void setCurrentProperty(BeanPropertyMeta currentProperty) { @@ -237,6 +239,7 @@ public class SerializerSession extends BeanSession { /** * Sets the current class being serialized for proper error messages. + * * @param currentClass The current class being serialized. */ public void setCurrentClass(ClassMeta<?> currentClass) { @@ -396,8 +399,8 @@ public class SerializerSession extends BeanSession { * @param attrName The attribute name. * @param o The current object being serialized. * @param eType The expected class type. - * @return The {@link ClassMeta} of the object so that <code>instanceof</code> operations - * only need to be performed once (since they can be expensive).<br> + * @return The {@link ClassMeta} of the object so that <code>instanceof</code> operations only need to be performed + * once (since they can be expensive). * @throws SerializeException If recursion occurred. */ public ClassMeta<?> push(String attrName, Object o, ClassMeta<?> eType) throws SerializeException { @@ -425,7 +428,7 @@ public class SerializerSession extends BeanSession { /** * Returns <jk>true</jk> if {@link SerializerContext#SERIALIZER_detectRecursions} is enabled, and the specified - * object is already higher up in the serialization chain. + * object is already higher up in the serialization chain. * * @param attrName The bean property attribute name, or some other identifier. * @param o The object to check for recursion. @@ -454,7 +457,8 @@ public class SerializerSession extends BeanSession { Object o = stack.removeLast().o; Object o2 = set.remove(o); if (o2 == null) - onError(null, "Couldn't remove object of type ''{0}'' on attribute ''{1}'' from object stack.", o.getClass().getName(), stack); + onError(null, "Couldn't remove object of type ''{0}'' on attribute ''{1}'' from object stack.", + o.getClass().getName(), stack); } isBottom = false; } @@ -478,7 +482,8 @@ public class SerializerSession extends BeanSession { if (listener != null) listener.onBeanGetterException(this, t, p); String prefix = (isDebug() ? getStack(false) + ": " : ""); - addWarning("{0}Could not call getValue() on property ''{1}'' of class ''{2}'', exception = {3}", prefix, p.getName(), p.getBeanMeta().getClassMeta(), t.getLocalizedMessage()); + addWarning("{0}Could not call getValue() on property ''{1}'' of class ''{2}'', exception = {3}", prefix, + p.getName(), p.getBeanMeta().getClassMeta(), t.getLocalizedMessage()); } /** @@ -599,26 +604,26 @@ public class SerializerSession extends BeanSession { * Converts a String to an absolute URI based on the {@link UriContext} on this session. * * @param uri The input URI. - * Can be any of the following: - * <ul> - * <li>{@link java.net.URI} - * <li>{@link java.net.URL} - * <li>{@link CharSequence} - * </ul> - * URI can be any of the following forms: - * <ul> - * <li><js>"foo://foo"</js> - Absolute URI. - * <li><js>"/foo"</js> - Root-relative URI. - * <li><js>"/"</js> - Root URI. - * <li><js>"context:/foo"</js> - Context-root-relative URI. - * <li><js>"context:/"</js> - Context-root URI. - * <li><js>"servlet:/foo"</js> - Servlet-path-relative URI. - * <li><js>"servlet:/"</js> - Servlet-path URI. - * <li><js>"request:/foo"</js> - Request-path-relative URI. - * <li><js>"request:/"</js> - Request-path URI. - * <li><js>"foo"</js> - Path-info-relative URI. - * <li><js>""</js> - Path-info URI. - * </ul> + * Can be any of the following: + * <ul> + * <li>{@link java.net.URI} + * <li>{@link java.net.URL} + * <li>{@link CharSequence} + * </ul> + * URI can be any of the following forms: + * <ul> + * <li><js>"foo://foo"</js> - Absolute URI. + * <li><js>"/foo"</js> - Root-relative URI. + * <li><js>"/"</js> - Root URI. + * <li><js>"context:/foo"</js> - Context-root-relative URI. + * <li><js>"context:/"</js> - Context-root URI. + * <li><js>"servlet:/foo"</js> - Servlet-path-relative URI. + * <li><js>"servlet:/"</js> - Servlet-path URI. + * <li><js>"request:/foo"</js> - Request-path-relative URI. + * <li><js>"request:/"</js> - Request-path URI. + * <li><js>"foo"</js> - Path-info-relative URI. + * <li><js>""</js> - Path-info URI. + * </ul> * @return The resolved URI. */ public String resolveUri(Object uri) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java index 7f7784b..628fc11 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/SerializerWriter.java @@ -20,8 +20,8 @@ import org.apache.juneau.*; /** * Simple wrapper around a standard {@link Writer} with additional methods. * <p> - * Modeled after the Java ProcessBuilder class so that you can chain commands to reduce - * the need for string concatenation for performance reasons. + * Modeled after the Java ProcessBuilder class so that you can chain commands to reduce the need for string + * concatenation for performance reasons. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -57,7 +57,8 @@ public class SerializerWriter extends Writer { * @param quoteChar The character to write when {@link #q()} is called. * @param uriResolver The URI resolver for resolving URIs to absolute or root-relative form. */ - public SerializerWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char quoteChar, UriResolver uriResolver) { + public SerializerWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char quoteChar, + UriResolver uriResolver) { this.out = out; this.useWhitespace = useWhitespace; this.maxIndent = maxIndent; @@ -97,8 +98,8 @@ public class SerializerWriter extends Writer { } /** - * Writes an indent (if the {@code useWhitespace} setting is enabled), followed by text, - * followed by a newline (if the {@code useWhitespace} setting is enabled). + * Writes an indent (if the {@code useWhitespace} setting is enabled), followed by text, followed by a newline + * (if the {@code useWhitespace} setting is enabled). * * @param indent The number of tabs to indent. * @param text The text to write. @@ -145,8 +146,8 @@ public class SerializerWriter extends Writer { } /** - * Writes an indent (if the {@code useWhitespace} setting is enabled), followed by text, - * optionally followed by a newline (if the {@code useWhitespace} setting is enabled). + * Writes an indent (if the {@code useWhitespace} setting is enabled), followed by text, optionally followed by a + * newline (if the {@code useWhitespace} setting is enabled). * * @param indent The number of tabs to indent. * @param newline If <jk>true</jk>, then a newline is written. @@ -165,8 +166,8 @@ public class SerializerWriter extends Writer { /** * Appends the specified object as a URI. * <p> - * Object is converted to a <code>String</code> using <code>toString()</code>, so this will work on {@link URL} or {@link URI} objects, - * or any other type that returns a URI via it's <code>toString()</code> method. + * Object is converted to a <code>String</code> using <code>toString()</code>, so this will work on {@link URL} or + * {@link URI} objects, or any other type that returns a URI via it's <code>toString()</code> method. * <p> * The URI is resolved based on the {@link SerializerContext#SERIALIZER_uriRelativity} and * {@link SerializerContext#SERIALIZER_uriResolution} settings and the {@link UriContext} that's part of the http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java b/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java index e379415..699eb74 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/WriterSerializer.java @@ -38,12 +38,13 @@ import org.apache.juneau.utils.*; * The media types that this serializer can produce is specified through the {@link Produces @Produces} annotation. * <p> * However, the media types can also be specified programmatically by overriding the {@link #getMediaTypes()} - * and {@link #getResponseContentType()} methods. + * and {@link #getResponseContentType()} methods. */ public abstract class WriterSerializer extends Serializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ protected WriterSerializer(PropertyStore propertyStore) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/serializer/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/serializer/package.html b/juneau-core/src/main/java/org/apache/juneau/serializer/package.html index 00e5568..fc85f8b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/serializer/package.html +++ b/juneau-core/src/main/java/org/apache/juneau/serializer/package.html @@ -70,9 +70,11 @@ <h2 class='topic' onclick='toggle(this)'>1 - Serializer API</h2> <div class='topic'> <p> - The serialization API is designed to be easily extensible by developers.<br> - If you are writing your own serializer, you will typically subclass directly from either {@link org.apache.juneau.serializer.WriterSerializer} - or {@link org.apache.juneau.serializer.OutputStreamSerializer}.<br> + The serialization API is designed to be easily extensible by developers. + <br> + If you are writing your own serializer, you will typically subclass directly from either + {@link org.apache.juneau.serializer.WriterSerializer} or + {@link org.apache.juneau.serializer.OutputStreamSerializer}. </p> <!-- ======================================================================================================== --> @@ -80,7 +82,8 @@ <h3 class='topic' onclick='toggle(this)'>1.1 - The SerializerGroup class</h3> <div class='topic'> <p> - The {@link org.apache.juneau.serializer.SerializerGroup} class represents a group of serializers registered with the media types they handle. + The {@link org.apache.juneau.serializer.SerializerGroup} class represents a group of serializers registered + with the media types they handle. </p> <h6 class='topic'>Features</h6> @@ -105,19 +108,22 @@ <h2 class='topic' onclick='toggle(this)'>2 - Defining a new Serializer</h2> <div class='topic'> <p> - Defining a new serializer is quite simple if you subclass directly from {@link org.apache.juneau.serializer.WriterSerializer} - or {@link org.apache.juneau.serializer.OutputStreamSerializer}.<br> - In each case, you simply need to implement a single - method and specify a {@link org.apache.juneau.annotation.Produces} annotation. + Defining a new serializer is quite simple if you subclass directly from + {@link org.apache.juneau.serializer.WriterSerializer} or {@link org.apache.juneau.serializer.OutputStreamSerializer}. + <br> + In each case, you simply need to implement a single method and specify a + {@link org.apache.juneau.annotation.Produces} annotation. </p> <p> - The following example shows a simple serializer that converts images to output streams using standard JRE classes. + The following example shows a simple serializer that converts images to output streams using standard JRE + classes. </p> <p class='bcode'> <ja>@Produces</ja>(<js>"image/png,image/jpeg"</js>) <jk>public static class</jk> ImageSerializer <jk>extends</jk> OutputStreamSerializer { <ja>@Override</ja> - <jk>public void</jk> serialize(Object o, OutputStream out, SerializerSession session) <jk>throws</jk> IOException, SerializeException { + <jk>public void</jk> serialize(Object o, OutputStream out, SerializerSession session) + <jk>throws</jk> IOException, SerializeException { RenderedImage image = (RenderedImage)o; String mediaType = ctx.getMediaType(); ImageIO.<jsm>write</jsm>(image, mediaType.substring(mediaType.indexOf(<js>'/'</js>)+1), out); @@ -125,9 +131,11 @@ } </p> <p> - Serializer that take advantage of the entire {@link org.apache.juneau.CoreObject} interface to be able to serialize arbitrary beans and POJOs is - considerably more complex and outside the scope of this document.<br> - If developing such a serializer, the best course of action would be to replicate what occurs in the {@link org.apache.juneau.json.JsonSerializer} class. + Serializer that take advantage of the entire {@link org.apache.juneau.CoreObject} interface to be able to + serialize arbitrary beans and POJOs is considerably more complex and outside the scope of this document. + <br> + If developing such a serializer, the best course of action would be to replicate what occurs in the + {@link org.apache.juneau.json.JsonSerializer} class. </p> </div> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java index b8bfc8c..7ea762b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java +++ b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializer.java @@ -45,6 +45,7 @@ public final class SoapXmlSerializer extends XmlSerializer { /** * Constructor. + * * @param propertyStore The property store containing all the settings for this object. */ public SoapXmlSerializer(PropertyStore propertyStore) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java index 0b6e50e..f4dfb85 100644 --- a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerBuilder.java @@ -35,6 +35,7 @@ public class SoapXmlSerializerBuilder extends XmlSerializerBuilder { /** * Constructor. + * * @param propertyStore The initial configuration settings for this builder. */ public SoapXmlSerializerBuilder(PropertyStore propertyStore) { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java index e13e10b..6d33b92 100644 --- a/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/soap/SoapXmlSerializerContext.java @@ -29,9 +29,12 @@ package org.apache.juneau.soap; * * <h6 class='topic'>Inherited configurable properties</h6> * <ul class='doctree'> - * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> - Properties associated with handling beans on serializers and parsers. + * <li class='jc'><a class="doclink" href="../BeanContext.html#ConfigProperties">BeanContext</a> + * - Properties associated with handling beans on serializers and parsers. * <ul> - * <li class='jc'><a class="doclink" href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a> - Configurable properties common to all serializers. + * <li class='jc'><a class="doclink" + * href="../serializer/SerializerContext.html#ConfigProperties">SerializerContext</a> + * - Configurable properties common to all serializers. * </ul> * </ul> */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/DefaultingVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/DefaultingVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/DefaultingVar.java index a1142c2..e8674ce 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/DefaultingVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/DefaultingVar.java @@ -17,8 +17,8 @@ import static org.apache.juneau.internal.StringUtils.*; /** * Interface for the resolution of vars with a default value if the <code>resolve()</code> method returns <jk>null</jk>. * <p> - * For example, to resolve the system property <js>"myProperty"</js> but resolve to <js>"not found"</js> if the property doesn't exist: - * <js>"$S{myProperty,not found}"</js> + * For example, to resolve the system property <js>"myProperty"</js> but resolve to <js>"not found"</js> if the + * property doesn't exist: <js>"$S{myProperty,not found}"</js> * <p> * Subclasses must implement the {@link #resolve(VarResolverSession, String)} method. * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/SimpleVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/SimpleVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/SimpleVar.java index e286a73..9091698 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/SimpleVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/SimpleVar.java @@ -17,10 +17,9 @@ import java.io.*; /** * Abstract superclass of all Simple Var Language variables that resolve to simple returned string values. * <p> - * Note the difference between this class and {@link StreamedVar} that streams - * values to writers. - * Unlike the {@link StreamedVar} class, the returned value from this class can - * contain nested variables that will be recursively resolved by {@link VarResolver}. + * Note the difference between this class and {@link StreamedVar} that streams values to writers. + * Unlike the {@link StreamedVar} class, the returned value from this class can contain nested variables that will be + * recursively resolved by {@link VarResolver}. * <p> * Subclasses must implement the {@link #resolve(VarResolverSession, String)} method. * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/StreamedVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/StreamedVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/StreamedVar.java index 22b5d50..4ab4540 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/StreamedVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/StreamedVar.java @@ -17,8 +17,8 @@ package org.apache.juneau.svl; * <p> * Note the difference between this class and {@link SimpleVar} that returns simple string values. * Unlike the {@link SimpleVar} class, the output from this class cannot contain nested variables. - * However, this class can be more efficient for variables that produce large amounts of output - * so that the creation of large in-memory strings is avoided. + * However, this class can be more efficient for variables that produce large amounts of output so that the creation + * of large in-memory strings is avoided. * <p> * Subclasses must implement the {@link #resolveTo(VarResolverSession, java.io.Writer, String)} method. * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/Var.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/Var.java b/juneau-core/src/main/java/org/apache/juneau/svl/Var.java index 29dc5f2..a68ecaa 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/Var.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/Var.java @@ -19,15 +19,16 @@ import java.io.*; /** * Abstract superclass of all Simple Var Language variables. * <p> - * Vars are used to convert simple variables of the form <js>"$varName{varKey}"</js> into - * something else by the {@link VarResolver} class. + * Vars are used to convert simple variables of the form <js>"$varName{varKey}"</js> into something else by the + * {@link VarResolver} class. * <p> * Subclasses must implement one of the following two methods: * <ul> * <li>{@link #resolve(VarResolverSession,String)} - For simple vars. * <li>{@link #resolveTo(VarResolverSession,Writer,String)} - For streamed vars. * </ul> - * Subclasses MUST implement a no-arg constructor so that class names can be passed to the {@link VarResolverBuilder#vars(Class...)} method. + * Subclasses MUST implement a no-arg constructor so that class names can be passed to the + * {@link VarResolverBuilder#vars(Class...)} method. * They must also be thread safe! * <p> * Two direct abstract subclasses are provided to differentiated between simple and streamed vars: @@ -47,8 +48,9 @@ public abstract class Var { * Constructor. * * @param name The name of this variable. - * @param streamed Whether this variable is 'streamed', meaning the {@link #resolveTo(VarResolverSession, Writer, String)} - * method is implemented. If <jk>false</jk>, then the {@link #resolve(VarResolverSession, String)} method is implemented. + * @param streamed Whether this variable is 'streamed', meaning the {@link #resolveTo(VarResolverSession, Writer, + * String)} method is implemented. + * If <jk>false</jk>, then the {@link #resolve(VarResolverSession, String)} method is implemented. */ public Var(String name, boolean streamed) { this.name = name; @@ -67,8 +69,8 @@ public abstract class Var { /** * Return the name of this variable. * <p> - * For example, the system property variable returns <js>"S"</js> since the format of the - * variable is <js>"$S{system.property}"</js>. + * For example, the system property variable returns <js>"S"</js> since the format of the variable is + * <js>"$S{system.property}"</js>. * * @return The name of this variable. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/VarResolver.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolver.java b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolver.java index deb3eb3..aa9cceb 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolver.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolver.java @@ -22,8 +22,9 @@ import org.apache.juneau.svl.vars.*; /** * Utility class for resolving variables of the form <js>"$X{key}"</js> in strings. * <p> - * Variables are of the form <code>$X{key}</code>, where <code>X</code> can consist of zero or more ASCII characters.<br> - * The variable key can contain anything, even nested variables that get recursively resolved. + * Variables are of the form <code>$X{key}</code>, where <code>X</code> can consist of zero or more ASCII characters. + * <br> + * The variable key can contain anything, even nested variables that get recursively resolved. * <p> * Variables are defined through the {@link VarResolverBuilder#vars(Class[])} method. * <p> @@ -55,26 +56,28 @@ import org.apache.juneau.svl.vars.*; * <p> * Var resolvers can have zero or more context objects associated with them. * <p> - * Context objects are arbitrary objects associated with this var resolver, such as - * a {@link ConfigFile} object. + * Context objects are arbitrary objects associated with this var resolver, such as a {@link ConfigFile} object. * They can be any class type. * <p> - * Context objects can be retrieved by {@link Var} classes through the {@link VarResolverSession#getSessionObject(Class, String)} method. + * Context objects can be retrieved by {@link Var} classes through the + * {@link VarResolverSession#getSessionObject(Class, String)} method. * * <h6 class='topic'>Session objects</h6> * <p> * Session objects are considered more ephemeral than context objects. - * While a context object is unlikely to ever change, a session object may change on every - * use of the var resolver. + * While a context object is unlikely to ever change, a session object may change on every use of the var resolver. * For example, the server API defines various <code>Var</code> objects that use the <code>RestRequest</code> - * object as a session object for the duration of a single HTTP request. + * object as a session object for the duration of a single HTTP request. * <p> - * Session objects are used by calling the {@link #createSession()} or {@link #createSession(Map)} methods to create an instance - * of a {@link VarResolverSession} object that contains {@link VarResolverSession#resolve(String)} and {@link VarResolverSession#resolveTo(String,Writer)} methods - * that are identical to {@link VarResolver#resolve(String)} and {@link VarResolver#resolveTo(String, Writer)} except that the <code>Var</code> objects - * have access to the session objects through the {@link VarResolverSession#getSessionObject(Class, String)} method. + * Session objects are used by calling the {@link #createSession()} or {@link #createSession(Map)} methods to create + * an instance of a {@link VarResolverSession} object that contains {@link VarResolverSession#resolve(String)} + * and {@link VarResolverSession#resolveTo(String,Writer)} methods that are identical to + * {@link VarResolver#resolve(String)} and {@link VarResolver#resolveTo(String, Writer)} except that the + * <code>Var</code> objects have access to the session objects through the + * {@link VarResolverSession#getSessionObject(Class, String)} method. * <p> - * Session objects are specified through either the {@link #createSession(Map)} method or the {@link VarResolverSession#sessionObject(String, Object)} methods. + * Session objects are specified through either the {@link #createSession(Map)} method or the + * {@link VarResolverSession#sessionObject(String, Object)} methods. * * <h6 class='topic'>Cloning</h6> * <p> @@ -84,7 +87,8 @@ import org.apache.juneau.svl.vars.*; * <h5 class='section'>Example:</h5> * <p class='bcode'> * <jc>// Create a resolver that copies the default resolver and adds $C and $ARG vars.</jc> - * VarResolver myVarResolver = VarResolver.<jsf>DEFAULT</jsf>.builder().vars(ConfigVar.<jk>class</jk>, ArgsVar.<jk>class</jk>).build(); + * VarResolver myVarResolver = VarResolver.<jsf>DEFAULT</jsf>.builder().vars(ConfigVar.<jk>class</jk>, + * ArgsVar.<jk>class</jk>).build(); * </p> * * @see org.apache.juneau.svl @@ -110,6 +114,7 @@ public class VarResolver { /** * Constructor. + * * @param vars The var classes * @param contextObjects */ @@ -130,6 +135,7 @@ public class VarResolver { /** * Returns the read-only properties on this variable resolver. + * * @return The read-only properties on this variable resolver. */ public VarResolverContext getContext() { @@ -139,7 +145,8 @@ public class VarResolver { /** * Creates a new resolver session with no session objects. * <p> - * Session objects can be associated with the specified session using the {@link VarResolverSession#sessionObject(String, Object)} method. + * Session objects can be associated with the specified session using the + * {@link VarResolverSession#sessionObject(String, Object)} method. * * @return A new resolver session. */ @@ -150,7 +157,7 @@ public class VarResolver { /** * Same as {@link #createSession()} except allows you to specify session objects as a map. * - * @param sessionObjects The session objects to associate with the sessino. + * @param sessionObjects The session objects to associate with the session. * @return A new resolver session. */ public VarResolverSession createSession(Map<String,Object> sessionObjects) { @@ -161,7 +168,8 @@ public class VarResolver { * Resolve variables in the specified string. * <p> * This is a shortcut for calling <code>createSession(<jk>null</jk>).resolve(s);</code>. - * This method can only be used if the string doesn't contain variables that rely on the existence of session variables. + * This method can only be used if the string doesn't contain variables that rely on the existence of session + * variables. * * @param s The input string. * @return The string with variables resolved, or the same string if it doesn't contain any variables to resolve. @@ -174,7 +182,8 @@ public class VarResolver { * Resolve variables in the specified string and sends the results to the specified writer. * <p> * This is a shortcut for calling <code>createSession(<jk>null</jk>).resolveTo(s, w);</code>. - * This method can only be used if the string doesn't contain variables that rely on the existence of session variables. + * This method can only be used if the string doesn't contain variables that rely on the existence of session + * variables. * * @param s The input string. * @param w The writer to send the result to. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java index d6df847..f4414dd 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverBuilder.java @@ -73,8 +73,8 @@ public class VarResolverBuilder { /** * Associates a context object with this resolver. * <p> - * A context object is essentially some environmental object that doesn't change - * but is used by vars to customize output. + * A context object is essentially some environmental object that doesn't change but is used by vars to customize + * output. * * @param name The name of the context object. * @param object The context object. @@ -88,8 +88,8 @@ public class VarResolverBuilder { /** * Associates multiple context objects with this resolver. * <p> - * A context object is essentially some environmental object that doesn't change - * but is used by vars to customize output. + * A context object is essentially some environmental object that doesn't change but is used by vars to customize + * output. * * @param map A map of context objects keyed by their name. * @return This object (for method chaining). http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverContext.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverContext.java b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverContext.java index 416ee57..1f9757d 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverContext.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverContext.java @@ -32,6 +32,7 @@ public class VarResolverContext { /** * Constructor. + * * @param vars The Var classes used for resolving string variables. * @param contextObjects Read-only context objects. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverSession.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverSession.java b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverSession.java index 8f7540b..ef012e3 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverSession.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/VarResolverSession.java @@ -26,8 +26,8 @@ import org.apache.juneau.*; * <p> * This class contains the workhorse code for var resolution. * <p> - * Instances of this class are created through the {@link VarResolver#createSession()} and {@link VarResolver#createSession(Map)} - * methods. + * Instances of this class are created through the {@link VarResolver#createSession()} and + * {@link VarResolver#createSession(Map)} methods. * <p> * Instances of this class are NOT guaranteed to be thread safe. * @@ -41,8 +41,8 @@ public class VarResolverSession { /** * Constructor. * - * @param context The {@link VarResolver} context object that contains the {@link Var Vars} and - * context objects associated with that resolver. + * @param context The {@link VarResolver} context object that contains the {@link Var Vars} and context objects + * associated with that resolver. * @param sessionObjects The session objects. * */ @@ -144,8 +144,8 @@ public class VarResolverSession { /** * Resolves variables in the specified string and sends the output to the specified writer. - * More efficient than first parsing to a string and then serializing to the writer since this - * method doesn't need to construct a large string. + * More efficient than first parsing to a string and then serializing to the writer since this method doesn't need + * to construct a large string. * * @param s The string to resolve variables in. * @param out The writer to write to. @@ -276,10 +276,12 @@ public class VarResolverSession { t = (T)sessionObjects.get(name); } } catch (Exception e) { - throw new FormattedRuntimeException(e, "Session object ''{0}'' or context object ''SvlContext.{0}'' could not be converted to type ''{1}''.", name, c); + throw new FormattedRuntimeException(e, + "Session object ''{0}'' or context object ''SvlContext.{0}'' could not be converted to type ''{1}''.", name, c); } if (t == null) - throw new FormattedRuntimeException("Session object ''{0}'' or context object ''SvlContext.{0}'' not found.", name); + throw new FormattedRuntimeException( + "Session object ''{0}'' or context object ''SvlContext.{0}'' not found.", name); return t; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/package.html ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/package.html b/juneau-core/src/main/java/org/apache/juneau/svl/package.html index 4cc559f..e282e01 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/package.html +++ b/juneau-core/src/main/java/org/apache/juneau/svl/package.html @@ -80,8 +80,8 @@ </p> <p> The {@link org.apache.juneau.svl.VarResolver} class is used to resolve variables. - The {@link org.apache.juneau.svl.VarResolver#DEFAULT} resolver will resolve <js>"$S{systemProperty}"</js> and <js>"$E{envVariable}"</js> - variables. + The {@link org.apache.juneau.svl.VarResolver#DEFAULT} resolver will resolve <js>"$S{systemProperty}"</js> + and <js>"$E{envVariable}"</js> variables. </p> <p class='bcode'> <jc>// Use the default variable resolver to resolve a string that contains $S (system property) variables</jc> @@ -139,32 +139,47 @@ <ul> <li class='jac'>{@link org.apache.juneau.svl.SimpleVar} - Superclass of all vars that return strings. <ul> - <li class='jac'>{@link org.apache.juneau.svl.DefaultingVar} - Variables that define a default value if the resolve method returns null. + <li class='jac'>{@link org.apache.juneau.svl.DefaultingVar} + - Variables that define a default value if the resolve method returns null. <ul> - <li class='jac'>{@link org.apache.juneau.svl.MapVar} - Variables that pull values from maps. + <li class='jac'>{@link org.apache.juneau.svl.MapVar} + - Variables that pull values from maps. <ul> - <li class='jc'>{@link org.apache.juneau.svl.vars.SystemPropertiesVar} - Resolves system properties. + <li class='jc'>{@link org.apache.juneau.svl.vars.SystemPropertiesVar} + - Resolves system properties. </ul> </li> - <li class='jc'>{@link org.apache.juneau.svl.vars.ArgsVar} - Resolves variables from an {@link org.apache.juneau.utils.Args} object. - <li class='jc'>{@link org.apache.juneau.svl.vars.ConfigFileVar} - Resolves variables from a {@link org.apache.juneau.ini.ConfigFile} object. - <li class='jc'>{@link org.apache.juneau.svl.vars.EnvVariablesVar} - Resolves environment variables. - <li class='jc'>{@link org.apache.juneau.svl.vars.ManifestFileVar} - Resolves variables from a {@link org.apache.juneau.utils.ManifestFile} object. - <li class='jc'>{@link org.apache.juneau.rest.vars.ServletInitParamVar} - Resolves servlet initialization parameters. + <li class='jc'>{@link org.apache.juneau.svl.vars.ArgsVar} + - Resolves variables from an {@link org.apache.juneau.utils.Args} object. + <li class='jc'>{@link org.apache.juneau.svl.vars.ConfigFileVar} + - Resolves variables from a {@link org.apache.juneau.ini.ConfigFile} object. + <li class='jc'>{@link org.apache.juneau.svl.vars.EnvVariablesVar} + - Resolves environment variables. + <li class='jc'>{@link org.apache.juneau.svl.vars.ManifestFileVar} + - Resolves variables from a {@link org.apache.juneau.utils.ManifestFile} object. + <li class='jc'>{@link org.apache.juneau.rest.vars.ServletInitParamVar} + - Resolves servlet initialization parameters. </ul> </li> - <li class='jac'>{@link org.apache.juneau.svl.MultipartVar} - Variables that consist of 2 or more comma-delimited arguments. + <li class='jac'>{@link org.apache.juneau.svl.MultipartVar} + - Variables that consist of 2 or more comma-delimited arguments. <ul> - <li class='jc'>{@link org.apache.juneau.rest.vars.LocalizationVar} - Resolves localized strings for an HTTP request. + <li class='jc'>{@link org.apache.juneau.rest.vars.LocalizationVar} + - Resolves localized strings for an HTTP request. </ul> </li> - <li class='jc'>{@link org.apache.juneau.rest.vars.RequestVar} - Resolves specialized HTTP request values. - <li class='jc'>{@link org.apache.juneau.rest.vars.UrlEncodeVar} - URL-encodes the value inside the variable. + <li class='jc'>{@link org.apache.juneau.rest.vars.RequestVar} + - Resolves specialized HTTP request values. + <li class='jc'>{@link org.apache.juneau.rest.vars.UrlEncodeVar} + - URL-encodes the value inside the variable. </ul> </li> - <li class='jac'>{@link org.apache.juneau.svl.StreamedVar} - Superclass of all vars that stream their value to writers. + <li class='jac'>{@link org.apache.juneau.svl.StreamedVar} + - Superclass of all vars that stream their value to writers. <ul> - <li class='jc'>{@link org.apache.juneau.rest.vars.SerializedRequestAttrVar} - Resolves HTTP request attribute values passed through a {@link org.apache.juneau.serializer.Serializer}. + <li class='jc'>{@link org.apache.juneau.rest.vars.SerializedRequestAttrVar} + - Resolves HTTP request attribute values passed through a + {@link org.apache.juneau.serializer.Serializer}. </ul> </li> </ul> @@ -181,47 +196,63 @@ Two methods are provided for resolving variables: </p> <ul class='doctree'> - <li class='jm'>{@link org.apache.juneau.svl.VarResolver#resolve(String)} - Resolves variables and returns the results as a simple string. - <li class='jm'>{@link org.apache.juneau.svl.VarResolver#resolveTo(String,Writer)} - Resolves variables and sends results to a writer. + <li class='jm'>{@link org.apache.juneau.svl.VarResolver#resolve(String)} + - Resolves variables and returns the results as a simple string. + <li class='jm'>{@link org.apache.juneau.svl.VarResolver#resolveTo(String,Writer)} + - Resolves variables and sends results to a writer. </ul> <p> Var resolvers can have zero or more context objects associated with them. - Some {@link org.apache.juneau.svl.Var Vars} rely on the existence of some other object, such as an {@link org.apache.juneau.utils.Args} object - for {@link org.apache.juneau.svl.vars.ArgsVar} or a {@link org.apache.juneau.ini.ConfigFile} for a {@link org.apache.juneau.svl.vars.ConfigFileVar}. + Some {@link org.apache.juneau.svl.Var Vars} rely on the existence of some other object, such as an + {@link org.apache.juneau.utils.Args} object + for {@link org.apache.juneau.svl.vars.ArgsVar} or a {@link org.apache.juneau.ini.ConfigFile} for a + {@link org.apache.juneau.svl.vars.ConfigFileVar}. These object dependencies are made by setting context objects on the var resolver. </p> <p> - Context objects are set through the {@link org.apache.juneau.svl.VarResolverBuilder#contextObject(String,Object)} method. + Context objects are set through the {@link org.apache.juneau.svl.VarResolverBuilder + #contextObject(String,Object)} method. They can be any class type. </p> <p> - Context objects are used by {@link org.apache.juneau.svl.Var Vars} by calling the {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. + Context objects are used by {@link org.apache.juneau.svl.Var Vars} by calling the + {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. </p> <p> In addition to context objects, there are also session objects. Session objects are considered more ephemeral than context objects. - While a context object is unlikely to ever change, a session object may change on every use of the var resolver. + While a context object is unlikely to ever change, a session object may change on every use of the var + resolver. For example, the server API defines various <code>Var</code> objects that use the <code>RestRequest</code> object as a session object for the duration of a single HTTP request. </p> <p> - Session objects are used by calling the {@link org.apache.juneau.svl.VarResolver#createSession()} or {@link org.apache.juneau.svl.VarResolver#createSession(Map)} methods to create an instance - of a {@link org.apache.juneau.svl.VarResolverSession} object that contains {@link org.apache.juneau.svl.VarResolverSession#resolve(String)} and {@link org.apache.juneau.svl.VarResolverSession#resolveTo(String,Writer)} methods - that are identical to {@link org.apache.juneau.svl.VarResolver#resolve(String)} and {@link org.apache.juneau.svl.VarResolver#resolveTo(String, Writer)} except that the <code>Var</code> objects - have access to the session objects through the {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. - Session objects are specified through either the {@link org.apache.juneau.svl.VarResolver#createSession(Map)} method or the {@link org.apache.juneau.svl.VarResolverSession#sessionObject(String, Object)} methods. + Session objects are used by calling the {@link org.apache.juneau.svl.VarResolver#createSession()} or + {@link org.apache.juneau.svl.VarResolver#createSession(Map)} methods to create an instance of a + {@link org.apache.juneau.svl.VarResolverSession} object that contains + {@link org.apache.juneau.svl.VarResolverSession#resolve(String)} and + {@link org.apache.juneau.svl.VarResolverSession#resolveTo(String,Writer)} methods that are identical to + {@link org.apache.juneau.svl.VarResolver#resolve(String)} and + {@link org.apache.juneau.svl.VarResolver#resolveTo(String, Writer)} except that the <code>Var</code> objects + have access to the session objects through the + {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. + Session objects are specified through either the {@link org.apache.juneau.svl.VarResolver#createSession(Map)} + method or the {@link org.apache.juneau.svl.VarResolverSession#sessionObject(String, Object)} methods. </p> <p> - Like Context object, Session objects are used by {@link org.apache.juneau.svl.Var Vars} by calling the {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. + Like Context object, Session objects are used by {@link org.apache.juneau.svl.Var Vars} by calling the + {@link org.apache.juneau.svl.VarResolverSession#getSessionObject(Class, String)} method. </p> <p> - Var resolvers can be cloned and extended by using the {@link org.apache.juneau.svl.VarResolver#builder()} method. + Var resolvers can be cloned and extended by using the {@link org.apache.juneau.svl.VarResolver#builder()} + method. Cloning a resolver will copy it's {@link org.apache.juneau.svl.Var} class names and context objects. </p> <h6 class='topic'>Example:</h6> <p class='bcode'> <jc>// Create a resolver that copies the default resolver and adds $C and $ARG vars.</jc> - VarResolver myVarResolver = VarResolver.<jsf>DEFAULT</jsf>.builder().vars(ConfigFileVar.<jk>class</jk>, ArgsVar.<jk>class</jk>).build(); + VarResolver myVarResolver = VarResolver.<jsf>DEFAULT</jsf>.builder().vars(ConfigFileVar.<jk>class</jk>, + ArgsVar.<jk>class</jk>).build(); </p> </div> @@ -230,13 +261,17 @@ <h3 class='topic' onclick='toggle(this)'>1.3 - Other Notes</h3> <div class='topic'> <ul class='spaced-list'> - <li>The escape character <js>'\'</js> can be used when necessary to escape the following characters: <code>$ , { }</code> - <li><b>WARNING:</b> It is possible to cause {@link java.lang.StackOverflowError StackOverflowErrors} if your nested variables result in - a recursive loop (e.g. the environment variable <code>'MYPROPERTY'</code> has the value <code>'$E{MYPROPERTY}'</code>). + <li>The escape character <js>'\'</js> can be used when necessary to escape the following characters: + <code>$ , { }</code> + <li><b>WARNING:</b> It is possible to cause {@link java.lang.StackOverflowError StackOverflowErrors} if + your nested variables result in a recursive loop (e.g. the environment variable + <code>'MYPROPERTY'</code> has the value <code>'$E{MYPROPERTY}'</code>). So don't do that! - <li>As a general rule, this class tries to be as efficient as possible by not creating new strings when not needed.<br> - For example, calling the resolve method on a string that doesn't contain variables (e.g. <code>resolver.resolve(<js>"foobar"</js>)</code>) - will simply be a no-op and return the same string. + <li>As a general rule, this class tries to be as efficient as possible by not creating new strings when not + needed. + <br> + For example, calling the resolve method on a string that doesn't contain variables (e.g. + <code>resolver.resolve(<js>"foobar"</js>)</code>) will simply be a no-op and return the same string. </ul> </div> </div> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/vars/ArgsVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ArgsVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ArgsVar.java index 6ec840e..5597a8b 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ArgsVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ArgsVar.java @@ -21,7 +21,7 @@ import org.apache.juneau.utils.*; * The format for this var is <js>"$ARG{argNameOrNum}"</js> or <js>"$ARG{argNameOrNum,defaultValue}"</js> * <p> * This variable resolver requires that an {@link Args} object be set as a context object on the resolver or a - * session object on the resolver session. + * session object on the resolver session. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -29,7 +29,8 @@ import org.apache.juneau.utils.*; * Args args = new Args(argv); * * <jc>// Create a variable resolver that resolves JVM arguments (e.g. "$ARG{1}")</jc> - * VarResolver r = <jk>new</jk> VarResolver().addVars(ArgsVar.<js>class</js>).addContextObject(<jsf>SESSION_args</jsf>, args); + * VarResolver r = <jk>new</jk> VarResolver().addVars(ArgsVar.<js>class</js>) + * .addContextObject(<jsf>SESSION_args</jsf>, args); * * <jc>// Use it!</jc> * System.<jsf>out</jsf>.println(r.resolve(<js>"Arg #1 is set to $ARG{1}"</js>)); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/vars/ConfigFileVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ConfigFileVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ConfigFileVar.java index 77023dc..04e704f 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ConfigFileVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ConfigFileVar.java @@ -22,7 +22,7 @@ import org.apache.juneau.svl.*; * See {@link ConfigFile#getString(String)} for the format of the key. * <p> * This variable resolver requires that a {@link ConfigFile} object be set as a context object on the resolver or a - * session object on the resolver session. + * session object on the resolver session. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -30,7 +30,8 @@ import org.apache.juneau.svl.*; * ConfigFile configFile = new ConfigFileBuilder().build(<js>"MyConfig.cfg"</js>); * * <jc>// Create a variable resolver that resolves config file entries (e.g. "$C{MySection/myKey}")</jc> - * VarResolver r = <jk>new</jk> VarResolver().addVars(ConfigVar.<js>class</js>).addContextObject(<jsf>SESSION_config</jsf>, configFile); + * VarResolver r = <jk>new</jk> VarResolver().addVars(ConfigVar.<js>class</js>) + * .addContextObject(<jsf>SESSION_config</jsf>, configFile); * * <jc>// Use it!</jc> * System.<jsf>out</jsf>.println(r.resolve(<js>"Value for myKey in section MySection is $C{MySection/myKey}"</js>)); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/vars/IfVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/vars/IfVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/vars/IfVar.java index f7eca79..922fb99 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/vars/IfVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/vars/IfVar.java @@ -26,8 +26,11 @@ import org.apache.juneau.svl.*; * </ul> * <p> * The boolean argument is any string. - * <br>The following values are interpreted as <jk>true</jk>: <js>"true"</js>,<js>"TRUE"</js>,<js>"t"</js>,<js>"T"</js>,<js>"1"</js>. - * <br>All else are interpreted as <jk>false</jk> + * <br> + * The following values are interpreted as <jk>true</jk>: <js>"true"</js>,<js>"TRUE"</js>,<js>"t"</js>, + * <js>"T"</js>,<js>"1"</js>. + * <br> + * All else are interpreted as <jk>false</jk> * * <h5 class='section'>Example:</h5> * <p class='bcode'> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/vars/ManifestFileVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ManifestFileVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ManifestFileVar.java index f117102..35bea2d 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/vars/ManifestFileVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/vars/ManifestFileVar.java @@ -21,7 +21,7 @@ import org.apache.juneau.utils.*; * The format for this var is <js>"$MF{key}"</js> or <js>"$MF{key,defaultValue}"</js> * <p> * This variable resolver requires that a {@link ManifestFile} object be set as a context object on the resolver or a - * session object on the resolver session. + * session object on the resolver session. * * <h5 class='section'>Example:</h5> * <p class='bcode'> @@ -29,7 +29,8 @@ import org.apache.juneau.utils.*; * ManifestFile mf = <jk>new</jk> ManifestFile(<jk>this</jk>.getClass()); * * <jc>// Create a variable resolver that resolves manifest file entries (e.g. "$MF{Main-Class}")</jc> - * VarResolver r = <jk>new</jk> VarResolver().addVars(ManifestFile.<js>class</js>).addContextObject(<jsf>SESSION_manifest</jsf>, mf); + * VarResolver r = <jk>new</jk> VarResolver().addVars(ManifestFile.<js>class</js>) + * .addContextObject(<jsf>SESSION_manifest</jsf>, mf); * * <jc>// Use it!</jc> * System.<jsf>out</jsf>.println(r.resolve(<js>"The main class is $MF{Main-Class}"</js>)); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/5c4762ee/juneau-core/src/main/java/org/apache/juneau/svl/vars/SwitchVar.java ---------------------------------------------------------------------- diff --git a/juneau-core/src/main/java/org/apache/juneau/svl/vars/SwitchVar.java b/juneau-core/src/main/java/org/apache/juneau/svl/vars/SwitchVar.java index 1f66516..caa6108 100644 --- a/juneau-core/src/main/java/org/apache/juneau/svl/vars/SwitchVar.java +++ b/juneau-core/src/main/java/org/apache/juneau/svl/vars/SwitchVar.java @@ -30,7 +30,8 @@ import org.apache.juneau.svl.*; * <li>... * </ul> * <p> - * The pattern can be any string optionally containing <js>'*'</js> or <js>'?'</js> representing any or one character respectively. + * The pattern can be any string optionally containing <js>'*'</js> or <js>'?'</js> representing any or one character + * respectively. * * <h5 class='section'>Example:</h5> * <p class='bcode'>
