diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java index d1c669820..6087d89ed 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java @@ -26,7 +26,7 @@ import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.api.serializer.ODataSerializerException; /** - * Root object for serving factory tasks and support loosely coupling of implementation (core) from the api. + * Root object for serving factory tasks and support loose coupling of implementation (core) from the API. * This is not a singleton (static variables) to avoid issues with synchronization, OSGi, hot deployment and so on. * Each thread (request) should keep its own instance. */ @@ -54,7 +54,7 @@ public abstract class OData { /** * Creates a new serializer object for rendering content in the specified format. * Serializers are used in Processor implementations. - * @param format - Any format supported by Olingo (XML, JSON ...) + * @param format - any format supported by Olingo (XML, JSON ...) */ public abstract ODataSerializer createSerializer(ODataFormat format) throws ODataSerializerException; @@ -65,8 +65,8 @@ public abstract class OData { public abstract ODataHttpHandler createHandler(Edm edm); /** - * Creates an metadata object. - * @param edmProvider - A custom or default implementation for creating metadata + * Creates a metadata object. + * @param edmProvider - a custom or default implementation for creating metadata */ public abstract Edm createEdm(EdmProvider edmProvider); diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java index 3fb6b4d46..6dda314ad 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java @@ -21,38 +21,79 @@ package org.apache.olingo.server.api; import java.util.Locale; import org.apache.olingo.commons.api.ODataException; +import org.apache.olingo.commons.api.http.HttpStatusCode; +/** + * Exception thrown by OData service implementations. + * @see ODataException + */ public class ODataApplicationException extends ODataException { private static final long serialVersionUID = 5358683245923127425L; - private int statusCode = 500; + private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(); private Locale locale; private String oDataErrorCode; - public ODataApplicationException(final String msg, int statusCode, Locale locale) { + /** + * Exception in an OData service implementation. + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages + * @see ODataException + * @see HttpStatusCode + */ + public ODataApplicationException(final String msg, final int statusCode, final Locale locale) { super(msg); this.statusCode = statusCode; this.locale = locale; } - public ODataApplicationException(final String msg, int statusCode, Locale locale, String oDataErrorCode) { - super(msg); - this.statusCode = statusCode; - this.locale = locale; + /** + * Exception in an OData service implementation. + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages + * @param oDataErrorCode the error code of the exception as defined by the OData standard + * @see ODataException + * @see HttpStatusCode + */ + public ODataApplicationException(final String msg, final int statusCode, final Locale locale, + final String oDataErrorCode) { + this(msg, statusCode, locale); this.oDataErrorCode = oDataErrorCode; } - public ODataApplicationException(final String msg, int statusCode, Locale locale, final Throwable cause) { + /** + * Exception in an OData service implementation. + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages + * @param cause the cause of this exception + * @see ODataException + * @see HttpStatusCode + * @see Throwable#getCause() + */ + public ODataApplicationException(final String msg, final int statusCode, final Locale locale, + final Throwable cause) { super(msg, cause); this.statusCode = statusCode; this.locale = locale; } - public ODataApplicationException(final String msg, int statusCode, Locale locale, final Throwable cause, - String oDataErrorCode) { - super(msg, cause); - this.statusCode = statusCode; - this.locale = locale; + /** + * Exception in an OData service implementation. + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages + * @param cause the cause of this exception + * @param oDataErrorCode the error code of the exception as defined by the OData standard + * @see ODataException + * @see HttpStatusCode + * @see Throwable#getCause() + */ + public ODataApplicationException(final String msg, final int statusCode, final Locale locale, final Throwable cause, + final String oDataErrorCode) { + this(msg, statusCode, locale, cause); this.oDataErrorCode = oDataErrorCode; } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java index 981292755..ad2e8ab2a 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java @@ -24,27 +24,30 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** - * Handels http requests as OData requests. + * Handles HTTP requests as OData requests. */ public interface ODataHttpHandler { /** - * Process an OData request. This includes uri parsing, content negotiation, dispatching the request to a specific - * custom processor implementation for handling data and creating the serialized content for the response object. - * @param request - must be a http OData request - * @param response - http OData response + *
Processes an OData request.
+ *This includes URI parsing, content negotiation, dispatching the request + * to a specific custom processor implementation for handling data and + * creating the serialized content for the response object.
+ * @param request - must be a HTTP OData request + * @param response - HTTP OData response */ void process(HttpServletRequest request, HttpServletResponse response); /** - * Register additional custom processor implementations for handling OData requests. If a request processing requires - * a processor which is not registered then an not implemented exception will happen. + *Registers additional custom processor implementations for handling OData requests.
+ *If request processing requires a processor that is not registered then a + * "not implemented" exception will happen.
*/ void register(Processor processor); /** - * Sets the split parameter which is used for service resolution. Default is 0. - * @param split + * Sets the split parameter which is used for service resolution. + * @param split the number of path segments reserved for service resolution; default is 0 */ void setSplit(int split); diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java index bba70e2b6..03e293691 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; /** - * Request object carry http information optimized and required to handle OData requests only. + * Request object to carry HTTP information optimized for and required to handle OData requests only. */ public class ODataRequest { private HttpMethod method; @@ -40,21 +40,28 @@ public class ODataRequest { private String rawServiceResolutionUri; /** - * @return the http method (GET, PUT, POST ...) + * Gets the HTTP method. + * @return the HTTP method (GET, PUT, POST ...) */ public HttpMethod getMethod() { return method; } + /** + * Sets the HTTP method. + * @param method the HTTP method (GET, PUT, POST ...) + */ public void setMethod(final HttpMethod method) { this.method = method; } /** - * Add header to request where name handled as case insensitive key. If a header already exists then the list of - * values will just be extended. - * @param name case insensitive header name - * @param values + *Adds a header to the request.
+ *The header name will be handled as case-insensitive key.
+ *If a header already exists then the list of values will just be extended.
+ * @param name case-insensitive header name + * @param values list of values for the given header name + * @see RFC 7230, section 3.2.2 */ public void addHeader(final String name, final List$format=json,$top=10
"
+ * @see RFC 3986, section 3.4
*/
public String getRawQueryPath() {
return rawQueryPath;
}
+ /**
+ * Sets the query part of the request URI.
+ * @see #getRawQueryPath()
+ */
public void setRawQueryPath(final String rawQueryPath) {
this.rawQueryPath = rawQueryPath;
}
/**
- * @return encoded base uri e.g. "http://localhost/my%20service"
+ * Gets the base URI.
+ * @return undecoded base URI, e.g., "http://localhost/my%20service
"
*/
public String getRawBaseUri() {
return rawBaseUri;
}
/**
- * @return encoded request uri e.g. "http://localhost/my%20service/sys1/Employees?$format=json"
+ * Sets the base URI.
+ * @see #getRawBaseUri()
+ */
+ public void setRawBaseUri(final String rawBaseUri) {
+ this.rawBaseUri = rawBaseUri;
+ }
+
+ /**
+ * Gets the total request URI.
+ * @return undecoded request URI, e.g., "http://localhost/my%20service/sys1/Employees?$format=json
"
*/
public String getRawRequestUri() {
return rawRequestUri;
}
/**
- * @return encoded OData path segments e.g. "/Employees"
+ * Sets the total request URI.
+ * @see #getRawRequestUri()
+ */
+ public void setRawRequestUri(final String rawRequestUri) {
+ this.rawRequestUri = rawRequestUri;
+ }
+
+ /**
+ * Gets the path segments of the request URI that belong to OData.
+ * @return undecoded OData path segments, e.g., "/Employees"
*/
public String getRawODataPath() {
return rawODataPath;
}
- public void setRawRequestUri(final String rawRequestUri) {
- this.rawRequestUri = rawRequestUri;
- }
-
+ /**
+ * Sets the path segments of the request URI that belong to OData.
+ * @see #getRawODataPath()
+ */
public void setRawODataPath(final String rawODataPath) {
this.rawODataPath = rawODataPath;
-
- }
-
- public void setRawBaseUri(final String rawBaseUri) {
- this.rawBaseUri = rawBaseUri;
}
/**
- * @return a decoded path segment that does not belong to the OData url schema or null e.g. "sys1"
+ * Gets the URI part responsible for service resolution.
+ * @return undecoded path segments that do not belong to the OData URL schema or null, e.g., "sys1
"
*/
public String getRawServiceResolutionUri() {
return rawServiceResolutionUri;
}
+ /**
+ * Sets the URI part responsible for service resolution.
+ * @see #getRawServiceResolutionUri()
+ */
public void setRawServiceResolutionUri(final String rawServiceResolutionUri) {
this.rawServiceResolutionUri = rawServiceResolutionUri;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
index b16f60c73..d701e0ba3 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
@@ -26,7 +26,7 @@ import java.util.Map;
import org.apache.olingo.commons.api.http.HttpStatusCode;
/**
- * Response object to carry OData relevant http information (statusCode, content & response headers)
+ * Response object to carry OData-relevant HTTP information (status code, response headers, and content).
*/
public class ODataResponse {
@@ -34,26 +34,51 @@ public class ODataResponse {
private Mapapplication/xml
for the metadata and
+ * application/json for the service document).
+ * Requesting a content type that is not supported results in an HTTP error
+ * 406 (Not Acceptable).
*/
public interface CustomContentTypeSupportProcessor {
/**
* Returns a list of supported content types.
- * @param defaultContentTypes content types supported by Olingos serializer
+ * @param defaultContentTypes content types supported by Olingo's serializer
+ * @param processorClass the {@link Processor} of the current request
* @return modified list of supported content types
- *
*/
public ListProcessor implementation for handling default cases: + *
This implementation is registered in the ODataHandler by default. + * The default can be replaced by re-registering a custom implementation.
*/ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ExceptionProcessor { diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java index 0e58c965e..a3df302b9 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java @@ -24,17 +24,16 @@ import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.uri.UriInfo; /** - * Processor interface for handling collections of entities (collections, EntitySets or feeds). + * Processor interface for handling collections of entities (e.g., EntitySets). */ public interface EntityCollectionProcessor extends Processor { /** - * Read entities data from persistency and puts serialized content and status into the response. - * @param request - OData request object containing raw http information. + * Reads entities data from persistency and puts serialized content and status into the response. + * @param request - OData request object containing raw HTTP information * @param response - OData response object for collecting response data - * @param uriInfo - information of a parsed OData uri + * @param uriInfo - information of a parsed OData URI * @param requestedContentType - requested content type after content negotiation */ void readCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestedContentType); - } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java index 7e00f2218..a277fa91f 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java @@ -24,17 +24,16 @@ import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.uri.UriInfo; /** - * Processor interface for handling a single entry (e.g. atom entry). + * Processor interface for handling a single Entity. */ public interface EntityProcessor extends Processor { /** - * Read entity data from persistency and puts serialized content and status into the response. - * @param request - OData request object containing raw http information. + * Reads entity data from persistency and puts serialized content and status into the response. + * @param request - OData request object containing raw HTTP information * @param response - OData response object for collecting response data - * @param uriInfo - information of a parsed OData uri + * @param uriInfo - information of a parsed OData URI * @param requestedContentType - requested content type after content negotiation */ void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType format); - } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java index f4b4f3e0c..967052b25 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ExceptionProcessor.java @@ -24,10 +24,17 @@ import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.ODataServerError; /** - * Processor which is called if any exception occurs inside the library or another processor + * Processor which is called if any exception occurs inside the library or another processor. */ public interface ExceptionProcessor extends Processor{ + /** + * Processes an exception. + * @param request the request + * @param response the response + * @param serverError the server error + * @param requestedContentType the requested format for the error message + */ public void processException(ODataRequest request, ODataResponse response, ODataServerError serverError, final ContentType requestedContentType); } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java index 331ba72f4..5abfe670f 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java @@ -30,10 +30,10 @@ import org.apache.olingo.server.api.uri.UriInfo; public interface MetadataProcessor extends Processor { /** - * Read data from persistency and puts serialized content and status into the response. - * @param request - OData request object containing raw http information. + * Reads data from persistency and puts serialized content and status into the response. + * @param request - OData request object containing raw HTTP information * @param response - OData response object for collecting response data - * @param uriInfo - information of a parsed OData uri + * @param uriInfo - information of a parsed OData URI * @param requestedContentType - requested content type after content negotiation */ void readMetadata(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestedContentType) diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java index 5d27ec8d0..1d7e1fb2c 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java @@ -22,16 +22,16 @@ import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.server.api.OData; /** - * Base interface for all processor types. Processors are responsible to read and write data and marshaling content - * within a request - response cycle. + *Base interface for all processor types.
+ *Processors are responsible to read and write data and marshalling content + * within a request - response cycle.
*/ public interface Processor { /** - * Initialize processor for each http request - response cycle. - * @param odata - Olingos root object which acts as a factory for various object types - * @param edm - the edm which needs to be created before the OData request handling takes place + * Initializes the processor for each HTTP request - response cycle. + * @param odata - Olingo's root object, acting as a factory for various object types + * @param edm - the EDM which needs to be created before the OData request handling takes place */ void init(OData odata, Edm edm); - } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java index 4deba80e6..784b28844 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java @@ -29,13 +29,12 @@ import org.apache.olingo.server.api.uri.UriInfo; public interface ServiceDocumentProcessor extends Processor { /** - * Read service document information from persistency and puts serialized content and status into the response. - * @param request - OData request object containing raw http information. + * Reads service-document information from persistency and puts serialized content and status into the response. + * @param request - OData request object containing raw HTTP information * @param response - OData response object for collecting response data - * @param uriInfo - information of a parsed OData uri + * @param uriInfo - information of a parsed OData URI * @param requestedContentType - requested content type after content negotiation */ void readServiceDocument(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestedContentType); - } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java index 91542aaff..8d11ee443 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java @@ -28,25 +28,47 @@ import org.apache.olingo.server.api.ODataServerError; import org.apache.olingo.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.server.api.uri.queryoption.SelectOption; +/** OData serializer */ public interface ODataSerializer { + /** The default character set is UTF-8. */ public static final String DEFAULT_CHARSET = "UTF-8"; + /** + * Writes the service document into an InputStream. + * @param edm the Entity Data Model + * @param serviceRoot the service-root URI of this OData service + */ InputStream serviceDocument(Edm edm, String serviceRoot) throws ODataSerializerException; + /** + * Writes the metadata document into an InputStream. + * @param edm the Entity Data Model + */ InputStream metadataDocument(Edm edm) throws ODataSerializerException; + /** + * Writes entity data into an InputStream. + * @param edmEntitySet the {@link EdmEntitySet} + * @param entity the data of the entity + * @param options options for the serializer + */ InputStream entity(EdmEntitySet edmEntitySet, Entity entity, ODataSerializerOptions options) throws ODataSerializerException; + /** + * Writes entity-set data into an InputStream. + * @param edmEntitySet the {@link EdmEntitySet} + * @param entitySet the data of the entity set + * @param options options for the serializer + */ InputStream entitySet(EdmEntitySet edmEntitySet, EntitySet entitySet, ODataSerializerOptions options) throws ODataSerializerException; /** * Writes an ODataError into an InputStream. * @param error the main error - * @return inputStream containing the OData formatted error - * @throws ODataSerializerException + * @return inputStream containing the OData-formatted error */ InputStream error(ODataServerError error) throws ODataSerializerException; @@ -56,7 +78,6 @@ public interface ODataSerializer { * @param expand the $expand option * @param select the $select option * @return a String with the select list - * @throws ODataSerializerException */ String buildContextURLSelectList(EdmEntitySet edmEntitySet, ExpandOption expand, SelectOption select) throws ODataSerializerException; diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerException.java index 615ee3de1..809be0744 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerException.java @@ -20,10 +20,12 @@ package org.apache.olingo.server.api.serializer; import org.apache.olingo.server.api.ODataTranslatedException; +/** Exception thrown by the {@link ODataSerializer}. */ public class ODataSerializerException extends ODataTranslatedException { private static final long serialVersionUID = 5358683245923127425L; + /** Keys for exception texts in the resource bundle. */ public static enum MessageKeys implements MessageKey { NOT_IMPLEMENTED, /** parameter: format */ UNSUPPORTED_FORMAT, @@ -42,11 +44,24 @@ public class ODataSerializerException extends ODataTranslatedException { } } + /** + * Creates serializer exception. + * @param developmentMessage message text as fallback and for debugging purposes + * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle + * @param parameters parameters for the exception text + */ public ODataSerializerException(final String developmentMessage, final MessageKey messageKey, final String... parameters) { super(developmentMessage, messageKey, parameters); } + /** + * Creates serializer exception. + * @param developmentMessage message text as fallback and for debugging purposes + * @param cause the cause of this exception + * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle + * @param parameters parameters for the exception text + */ public ODataSerializerException(final String developmentMessage, final Throwable cause, final MessageKey messageKey, final String... parameters) { super(developmentMessage, cause, messageKey, parameters); diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerOptions.java index 3e2306623..e4ac7672b 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerOptions.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializerOptions.java @@ -23,6 +23,7 @@ import org.apache.olingo.server.api.uri.queryoption.CountOption; import org.apache.olingo.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.server.api.uri.queryoption.SelectOption; +/** Options for the OData serializer. */ public class ODataSerializerOptions { private ContextURL contextURL; @@ -30,28 +31,34 @@ public class ODataSerializerOptions { private ExpandOption expand; private SelectOption select; + /** Gets the {@link ContextURL}. */ public ContextURL getContextURL() { return contextURL; } + /** Gets the $count system query option. */ public CountOption getCount() { return count; } + /** Gets the $expand system query option. */ public ExpandOption getExpand() { return expand; } + /** Gets the $select system query option. */ public SelectOption getSelect() { return select; } private ODataSerializerOptions() {} + /** Initializes the options builder. */ public static Builder with() { return new Builder(); } + /** Builder of OData serializer options. */ public static final class Builder { private ODataSerializerOptions options; @@ -60,26 +67,31 @@ public class ODataSerializerOptions { options = new ODataSerializerOptions(); } + /** Sets the {@link ContextURL}. */ public Builder contextURL(final ContextURL contextURL) { options.contextURL = contextURL; return this; } + /** Sets the $count system query option. */ public Builder count(final CountOption count) { options.count = count; return this; } + /** Sets the $expand system query option. */ public Builder expand(final ExpandOption expand) { options.expand = expand; return this; } + /** Sets the $select system query option. */ public Builder select(final SelectOption select) { options.select = select; return this; } + /** Builds the OData serializer options. */ public ODataSerializerOptions build() { return options; }