Skip to content

Commit c5f8a40

Browse files
author
ehennum
committed
relax parameters for expression casting on server #1263
1 parent 233f38c commit c5f8a40

File tree

87 files changed

+3435
-2516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3435
-2516
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/expression/CtsExpr.java

+1,390-1,194
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/expression/GeoExpr.java

+112-86
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ protected PlanBuilder(
175175
*/
176176
public abstract ServerExpression divide(ServerExpression left, ServerExpression right);
177177
/**
178-
* This function returns true if the left and right expressions return the same value. Otherwise, it returns false. In expressions, the call should pass the result from an op:col function to identify a column.
178+
* This function takes two or more expressions and returns true if all of the expressions return the same value. Otherwise, it returns false. The expressions can include calls to the op:col function to get the value of a column.
179179
* <p>
180180
* Provides a client interface to the <a href="http://docs.marklogic.com/op:eq" target="mlserverdoc">op:eq</a> server function.
181-
* @param left The left value expression. (of <a href="{@docRoot}/doc-files/types/xs_anyAtomicType.html">xs:anyAtomicType</a>)
181+
* @param operand Two or more expressions. (of <a href="{@docRoot}/doc-files/types/xs_anyAtomicType.html">xs:anyAtomicType</a>)
182182
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_boolean.html">xs:boolean</a> server data type
183183
*/
184-
public abstract ServerExpression eq(ServerExpression... left);
184+
public abstract ServerExpression eq(ServerExpression... operand);
185185
/**
186186
* This function returns true if the value of the left expression is greater than or equal to the value of the right expression. Otherwise, it returns false.
187187
* <p>
@@ -981,14 +981,14 @@ protected PlanBuilder(
981981
*/
982982
public abstract ServerExpression jsonDocument(ServerExpression root);
983983
/**
984-
* This function specifies the key expression and value content for a JSON property of a JSON object contructed by the op:json-object function.
984+
* This function specifies the key expression and value content for a JSON property of a JSON object constructed by the op:json-object function.
985985
* @param key The key expression. This must evaluate to a string. (of <a href="{@docRoot}/doc-files/types/xs_string.html">xs:string</a>)
986986
* @param value The value content. This must be exactly one JSON node expression. (of <a href="{@docRoot}/doc-files/types/json-content-node.html">json-content-node</a>)
987987
* @return a PlanJsonProperty object
988988
*/
989989
public abstract PlanJsonProperty prop(String key, ServerExpression value);
990990
/**
991-
* This function specifies the key expression and value content for a JSON property of a JSON object contructed by the op:json-object function.
991+
* This function specifies the key expression and value content for a JSON property of a JSON object constructed by the op:json-object function.
992992
* @param key The key expression. This must evaluate to a string. (of <a href="{@docRoot}/doc-files/types/xs_string.html">xs:string</a>)
993993
* @param value The value content. This must be exactly one JSON node expression. (of <a href="{@docRoot}/doc-files/types/json-content-node.html">json-content-node</a>)
994994
* @return a PlanJsonProperty object

marklogic-client-api/src/main/java/com/marklogic/client/expression/SemExpr.java

+42-36
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/expression/SqlExpr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ public interface SqlExpr {
456456
* <p>
457457
* Provides a client interface to the <a href="http://docs.marklogic.com/sql:sign" target="mlserverdoc">sql:sign</a> server function.
458458
* @param x The number to be evaluated. (of <a href="{@docRoot}/doc-files/types/xs_numeric.html">xs:numeric</a>)
459-
* @return a server expression with the <a href="{@docRoot}/doc-files/types/item.html">item</a> server data type
459+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_numeric.html">xs:numeric</a> server data type
460460
*/
461461
public ServerExpression sign(ServerExpression x);
462462
/**

marklogic-client-api/src/main/java/com/marklogic/client/expression/XdmpExpr.java

+15-15
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/impl/CtsExprImpl.java

+205-199
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/impl/GeoExprImpl.java

+88-76
Large diffs are not rendered by default.

marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderImpl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ public ServerExpression divide(ServerExpression left, ServerExpression right) {
268268

269269

270270
@Override
271-
public ServerExpression eq(ServerExpression... left) {
272-
if (left == null) {
273-
throw new IllegalArgumentException("left parameter for eq() cannot be null");
271+
public ServerExpression eq(ServerExpression... operand) {
272+
if (operand == null) {
273+
throw new IllegalArgumentException("operand parameter for eq() cannot be null");
274274
}
275-
return new XsExprImpl.BooleanCallImpl("op", "eq", left);
275+
return new XsExprImpl.BooleanCallImpl("op", "eq", operand);
276276
}
277277

278278

marklogic-client-api/src/main/java/com/marklogic/client/impl/SemExprImpl.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public SemStoreExpr rulesetStore(String locations) {
208208

209209

210210
@Override
211-
public SemStoreExpr rulesetStore(XsStringSeqVal locations) {
211+
public SemStoreExpr rulesetStore(ServerExpression locations) {
212212
return new StoreCallImpl("sem", "ruleset-store", new Object[]{ locations });
213213
}
214214

@@ -220,19 +220,19 @@ public SemStoreExpr rulesetStore(String locations, SemStoreExpr... store) {
220220

221221

222222
@Override
223-
public SemStoreExpr rulesetStore(XsStringSeqVal locations, SemStoreSeqExpr store) {
223+
public SemStoreExpr rulesetStore(ServerExpression locations, ServerExpression store) {
224224
return new StoreCallImpl("sem", "ruleset-store", new Object[]{ locations, store });
225225
}
226226

227227

228228
@Override
229-
public SemStoreExpr rulesetStore(String locations, SemStoreSeqExpr store, String options) {
229+
public SemStoreExpr rulesetStore(String locations, ServerExpression store, String options) {
230230
return rulesetStore((locations == null) ? (XsStringVal) null : xs.string(locations), store, (options == null) ? (XsStringVal) null : xs.string(options));
231231
}
232232

233233

234234
@Override
235-
public SemStoreExpr rulesetStore(XsStringSeqVal locations, SemStoreSeqExpr store, XsStringSeqVal options) {
235+
public SemStoreExpr rulesetStore(ServerExpression locations, ServerExpression store, ServerExpression options) {
236236
return new StoreCallImpl("sem", "ruleset-store", new Object[]{ locations, store, options });
237237
}
238238

@@ -268,19 +268,19 @@ public SemStoreExpr store(String options) {
268268

269269

270270
@Override
271-
public SemStoreExpr store(XsStringSeqVal options) {
271+
public SemStoreExpr store(ServerExpression options) {
272272
return new StoreCallImpl("sem", "store", new Object[]{ options });
273273
}
274274

275275

276276
@Override
277-
public SemStoreExpr store(String options, CtsQueryExpr query) {
277+
public SemStoreExpr store(String options, ServerExpression query) {
278278
return store((options == null) ? (XsStringVal) null : xs.string(options), query);
279279
}
280280

281281

282282
@Override
283-
public SemStoreExpr store(XsStringSeqVal options, CtsQueryExpr query) {
283+
public SemStoreExpr store(ServerExpression options, ServerExpression query) {
284284
return new StoreCallImpl("sem", "store", new Object[]{ options, query });
285285
}
286286

marklogic-client-api/src/main/java/com/marklogic/client/impl/SqlExprImpl.java

+1-52
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,12 @@ public ServerExpression dateadd(ServerExpression datepart, int number, ServerExp
7272

7373
@Override
7474
public ServerExpression dateadd(ServerExpression datepart, ServerExpression number, ServerExpression date) {
75-
if (datepart == null) {
76-
throw new IllegalArgumentException("datepart parameter for dateadd() cannot be null");
77-
}
78-
if (number == null) {
79-
throw new IllegalArgumentException("number parameter for dateadd() cannot be null");
80-
}
81-
if (date == null) {
82-
throw new IllegalArgumentException("date parameter for dateadd() cannot be null");
83-
}
8475
return new BaseTypeImpl.ItemCallImpl("sql", "dateadd", new Object[]{ datepart, number, date });
8576
}
8677

8778

8879
@Override
8980
public ServerExpression datediff(ServerExpression datepart, ServerExpression startdate, ServerExpression enddate) {
90-
if (datepart == null) {
91-
throw new IllegalArgumentException("datepart parameter for datediff() cannot be null");
92-
}
93-
if (startdate == null) {
94-
throw new IllegalArgumentException("startdate parameter for datediff() cannot be null");
95-
}
96-
if (enddate == null) {
97-
throw new IllegalArgumentException("enddate parameter for datediff() cannot be null");
98-
}
9981
return new XsExprImpl.IntegerCallImpl("sql", "datediff", new Object[]{ datepart, startdate, enddate });
10082
}
10183

@@ -201,9 +183,6 @@ public ServerExpression left(ServerExpression str, double n) {
201183

202184
@Override
203185
public ServerExpression left(ServerExpression str, ServerExpression n) {
204-
if (n == null) {
205-
throw new IllegalArgumentException("n parameter for left() cannot be null");
206-
}
207186
return new XsExprImpl.StringCallImpl("sql", "left", new Object[]{ str, n });
208187
}
209188

@@ -243,9 +222,6 @@ public ServerExpression like(ServerExpression input, ServerExpression pattern, S
243222

244223
@Override
245224
public ServerExpression ltrim(ServerExpression str) {
246-
if (str == null) {
247-
throw new IllegalArgumentException("str parameter for ltrim() cannot be null");
248-
}
249225
return new XsExprImpl.StringCallImpl("sql", "ltrim", new Object[]{ str });
250226
}
251227

@@ -318,9 +294,6 @@ public ServerExpression right(ServerExpression str, double n) {
318294

319295
@Override
320296
public ServerExpression right(ServerExpression str, ServerExpression n) {
321-
if (n == null) {
322-
throw new IllegalArgumentException("n parameter for right() cannot be null");
323-
}
324297
return new XsExprImpl.StringCallImpl("sql", "right", new Object[]{ str, n });
325298
}
326299

@@ -333,9 +306,6 @@ public ServerExpression rowID(ServerExpression arg1) {
333306

334307
@Override
335308
public ServerExpression rtrim(ServerExpression str) {
336-
if (str == null) {
337-
throw new IllegalArgumentException("str parameter for rtrim() cannot be null");
338-
}
339309
return new XsExprImpl.StringCallImpl("sql", "rtrim", new Object[]{ str });
340310
}
341311

@@ -348,7 +318,7 @@ public ServerExpression seconds(ServerExpression arg) {
348318

349319
@Override
350320
public ServerExpression sign(ServerExpression x) {
351-
return new BaseTypeImpl.ItemSeqCallImpl("sql", "sign", new Object[]{ x });
321+
return new XsExprImpl.NumericCallImpl("sql", "sign", new Object[]{ x });
352322
}
353323

354324

@@ -360,9 +330,6 @@ public ServerExpression soundex(ServerExpression arg) {
360330

361331
@Override
362332
public ServerExpression space(ServerExpression n) {
363-
if (n == null) {
364-
throw new IllegalArgumentException("n parameter for space() cannot be null");
365-
}
366333
return new XsExprImpl.StringCallImpl("sql", "space", new Object[]{ n });
367334
}
368335

@@ -399,30 +366,12 @@ public ServerExpression timestampadd(ServerExpression dateTimeType, int value, S
399366

400367
@Override
401368
public ServerExpression timestampadd(ServerExpression dateTimeType, ServerExpression value, ServerExpression timestamp) {
402-
if (dateTimeType == null) {
403-
throw new IllegalArgumentException("dateTimeType parameter for timestampadd() cannot be null");
404-
}
405-
if (value == null) {
406-
throw new IllegalArgumentException("value parameter for timestampadd() cannot be null");
407-
}
408-
if (timestamp == null) {
409-
throw new IllegalArgumentException("timestamp parameter for timestampadd() cannot be null");
410-
}
411369
return new BaseTypeImpl.ItemCallImpl("sql", "timestampadd", new Object[]{ dateTimeType, value, timestamp });
412370
}
413371

414372

415373
@Override
416374
public ServerExpression timestampdiff(ServerExpression dateTimeType, ServerExpression timestamp1, ServerExpression timestamp2) {
417-
if (dateTimeType == null) {
418-
throw new IllegalArgumentException("dateTimeType parameter for timestampdiff() cannot be null");
419-
}
420-
if (timestamp1 == null) {
421-
throw new IllegalArgumentException("timestamp1 parameter for timestampdiff() cannot be null");
422-
}
423-
if (timestamp2 == null) {
424-
throw new IllegalArgumentException("timestamp2 parameter for timestampdiff() cannot be null");
425-
}
426375
return new XsExprImpl.IntegerCallImpl("sql", "timestampdiff", new Object[]{ dateTimeType, timestamp1, timestamp2 });
427376
}
428377

marklogic-client-api/src/main/java/com/marklogic/client/type/PlanColumn.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
* An instance of a column expression returned by a col() call
2222
* in a row pipeline.
2323
*/
24-
public interface PlanColumn extends PlanExprCol, ServerExpression, PlanTriplePosition, PlanColumnSeq {
24+
public interface PlanColumn extends PlanExprCol, PlanTriplePosition, PlanColumnSeq {
2525
}

marklogic-client-api/src/main/java/com/marklogic/client/type/PlanColumnSeq.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
* A sequence of column expressions returned by col() calls
2222
* for a row pipeline.
2323
*/
24-
public interface PlanColumnSeq extends PlanExprColSeq {
24+
public interface PlanColumnSeq extends PlanExprColSeq, ServerExpression {
2525
}

marklogic-client-api/src/main/java/com/marklogic/client/type/PlanParamExpr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
* in expressions and can be passed on a bind() call to be
2424
* assigned a literal value when invoking a row pipeline.
2525
*/
26-
public interface PlanParamExpr extends ServerExpression, PlanParamSeqExpr, PlanTriplePosition {
26+
public interface PlanParamExpr extends PlanParamSeqExpr, PlanTriplePosition {
2727
}

marklogic-client-api/src/main/java/com/marklogic/client/type/PlanParamSeqExpr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
* in expressions and can be passed on bind() calls to be
2424
* assigned literal values when invoking a row pipeline.
2525
*/
26-
public interface PlanParamSeqExpr {
26+
public interface PlanParamSeqExpr extends ServerExpression {
2727
}

marklogic-client-api/src/main/java/com/marklogic/client/type/SemStoreSeqExpr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
/**
1919
* A sequence of semantic store expressions.
2020
*/
21-
public interface SemStoreSeqExpr {
21+
public interface SemStoreSeqExpr extends ServerExpression {
2222

2323
}

marklogic-client-api/src/main/javadoc/doc-files/types/cts_box.html

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
<td class="colLast"><span class="memberNameLink">cts:box</span>(<span><a href="xs_double.html">xs:double</a> <i>south</i></span>, <span><a href="xs_double.html">xs:double</a> <i>west</i></span>, <span><a href="xs_double.html">xs:double</a> <i>north</i></span>, <span><a href="xs_double.html">xs:double</a> <i>east</i></span>)</td>
2222
<td><a href="../../com/marklogic/client/expression/CtsExpr.html#ml-server-type-box">java</a></td>
2323
</tr>
24-
</table></div><br/><div class="summary"><h3>Supertypes</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
25-
<td><a href="item.html">item</a></td>
26-
</tr>
2724
</table></div><br/><div class="summary"><h3>Parameter Of</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr>
2825
<th class="colFirst" scope="col">Server Return Type</th>
2926
<th class="colLast" scope="col">Server Function</th>

marklogic-client-api/src/main/javadoc/doc-files/types/cts_collection-reference.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
</head>
77
<body><div class="topNav"><ul class="navList" title="Navigation">
88
<li><a href="../../overview-summary.html">Overview</a></li>
9+
<li><a href="../../com/marklogic/client/expression/package-summary.html">Package</a></li>
910
<li><a href="../../deprecated-list.html">Deprecated</a></li>
1011
<li><a href="../../index-all.html">Index</a></li>
1112
<li><a href="../../help-doc.html">Help</a></li>
12-
</ul></div><div class="header"><h2>cts:collection-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:collection-reference server type.</p><br/><div class="summary"><h3>Implicit Cast To</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
13+
</ul></div><div class="header"><h2>cts:collection-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:collection-reference server type.
14+
For all server types, see the <a href="ml-server-type-tree.html">Server Expression Type Hierarchy</a>.</p><br/><div class="summary"><h3>Supertypes</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
1315
<td><a href="cts_reference.html">cts:reference</a></td>
16+
<td><a href="item.html">item</a></td>
1417
</tr>
1518
</table></div></div></body>
1619
</html>

marklogic-client-api/src/main/javadoc/doc-files/types/cts_element-attribute-reference.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
</head>
77
<body><div class="topNav"><ul class="navList" title="Navigation">
88
<li><a href="../../overview-summary.html">Overview</a></li>
9+
<li><a href="../../com/marklogic/client/expression/package-summary.html">Package</a></li>
910
<li><a href="../../deprecated-list.html">Deprecated</a></li>
1011
<li><a href="../../index-all.html">Index</a></li>
1112
<li><a href="../../help-doc.html">Help</a></li>
12-
</ul></div><div class="header"><h2>cts:element-attribute-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:element-attribute-reference server type.</p><br/><div class="summary"><h3>Implicit Cast To</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
13+
</ul></div><div class="header"><h2>cts:element-attribute-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:element-attribute-reference server type.
14+
For all server types, see the <a href="ml-server-type-tree.html">Server Expression Type Hierarchy</a>.</p><br/><div class="summary"><h3>Supertypes</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
1315
<td><a href="cts_reference.html">cts:reference</a></td>
16+
<td><a href="item.html">item</a></td>
1417
</tr>
1518
</table></div></div></body>
1619
</html>

marklogic-client-api/src/main/javadoc/doc-files/types/cts_element-reference.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
</head>
77
<body><div class="topNav"><ul class="navList" title="Navigation">
88
<li><a href="../../overview-summary.html">Overview</a></li>
9+
<li><a href="../../com/marklogic/client/expression/package-summary.html">Package</a></li>
910
<li><a href="../../deprecated-list.html">Deprecated</a></li>
1011
<li><a href="../../index-all.html">Index</a></li>
1112
<li><a href="../../help-doc.html">Help</a></li>
12-
</ul></div><div class="header"><h2>cts:element-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:element-reference server type.</p><br/><div class="summary"><h3>Implicit Cast To</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
13+
</ul></div><div class="header"><h2>cts:element-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:element-reference server type.
14+
For all server types, see the <a href="ml-server-type-tree.html">Server Expression Type Hierarchy</a>.</p><br/><div class="summary"><h3>Supertypes</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
1315
<td><a href="cts_reference.html">cts:reference</a></td>
16+
<td><a href="item.html">item</a></td>
1417
</tr>
1518
</table></div></div></body>
1619
</html>

marklogic-client-api/src/main/javadoc/doc-files/types/cts_field-reference.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
</head>
77
<body><div class="topNav"><ul class="navList" title="Navigation">
88
<li><a href="../../overview-summary.html">Overview</a></li>
9+
<li><a href="../../com/marklogic/client/expression/package-summary.html">Package</a></li>
910
<li><a href="../../deprecated-list.html">Deprecated</a></li>
1011
<li><a href="../../index-all.html">Index</a></li>
1112
<li><a href="../../help-doc.html">Help</a></li>
12-
</ul></div><div class="header"><h2>cts:field-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:field-reference server type.</p><br/><div class="summary"><h3>Implicit Cast To</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
13+
</ul></div><div class="header"><h2>cts:field-reference Server Expression</h2></div><div class="contentContainer"><p>A server expression that returns a value of (or implicitly castable to) the cts:field-reference server type.
14+
For all server types, see the <a href="ml-server-type-tree.html">Server Expression Type Hierarchy</a>.</p><br/><div class="summary"><h3>Supertypes</h3><table class="memberSummary" border="0" cellpadding="3" cellspacing="0"><tr class="altColor">
1315
<td><a href="cts_reference.html">cts:reference</a></td>
16+
<td><a href="item.html">item</a></td>
1417
</tr>
1518
</table></div></div></body>
1619
</html>

0 commit comments

Comments
 (0)