Skip to content

Commit 8495c4a

Browse files
[refactor] Re-add value constructors without expressions.
1 parent 4904a69 commit 8495c4a

File tree

123 files changed

+1049
-702
lines changed

Some content is hidden

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

123 files changed

+1049
-702
lines changed

exist-core/src/main/antlr/org/exist/xquery/parser/XQueryTree.g

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ throws PermissionDeniedException, EXistException, XPathException
418418
#(
419419
"base-uri" base:STRING_LITERAL
420420
{
421-
context.setBaseURI(new AnyURIValue(null, StringValue.expand(base.getText(), null)), true);
421+
context.setBaseURI(new AnyURIValue(StringValue.expand(base.getText(), null)), true);
422422
if (baseuri)
423423
throw new XPathException(base, ErrorCodes.XQST0032, "Base URI is already declared.");
424424
baseuri = true;
@@ -966,7 +966,7 @@ throws XPathException
966966
#(
967967
uri:STRING_LITERAL
968968
{
969-
AnyURIValue any= new AnyURIValue(null, uri.getText());
969+
AnyURIValue any= new AnyURIValue(uri.getText());
970970
uris.add(any);
971971
}
972972
)
@@ -2751,29 +2751,29 @@ throws XPathException
27512751
:
27522752
c:STRING_LITERAL
27532753
{
2754-
StringValue val = new StringValue(null, c.getText());
2754+
StringValue val = new StringValue(c.getText());
27552755
val.expand();
27562756
step= new LiteralValue(context, val);
27572757
step.setASTNode(c);
27582758
}
27592759
|
27602760
i:INTEGER_LITERAL
27612761
{
2762-
step= new LiteralValue(context, new IntegerValue(null, i.getText()));
2762+
step= new LiteralValue(context, new IntegerValue(i.getText()));
27632763
step.setASTNode(i);
27642764
}
27652765
|
27662766
(
27672767
dec:DECIMAL_LITERAL
27682768
{
2769-
step= new LiteralValue(context, new DecimalValue(null, dec.getText()));
2769+
step= new LiteralValue(context, new DecimalValue(dec.getText()));
27702770
step.setASTNode(dec);
27712771
}
27722772
|
27732773
dbl:DOUBLE_LITERAL
27742774
{
27752775
step= new LiteralValue(context,
2776-
new DoubleValue(null, Double.parseDouble(dbl.getText())));
2776+
new DoubleValue(Double.parseDouble(dbl.getText())));
27772777
step.setASTNode(dbl);
27782778
}
27792779
)

exist-core/src/main/java/org/exist/backup/AbstractBackupDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Date getDate() {
4646
final String dateStr = properties.getProperty("date");
4747

4848
if (dateStr != null) {
49-
final DateTimeValue dtv = new DateTimeValue(null, dateStr);
49+
final DateTimeValue dtv = new DateTimeValue(dateStr);
5050
date = dtv.getDate();
5151
}
5252
} catch (final IOException | XPathException e) {

exist-core/src/main/java/org/exist/backup/Backup.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ private void backup(final Set<String> seenBlobIds, final Collection current, fin
305305
//The name should have come from an XmldbURI.toString() call
306306
attr.addAttribute(Namespaces.EXIST_NS, "name", "name", "CDATA", current.getName());
307307
writeUnixStylePermissionAttributes(attr, currentPerms);
308-
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue(null, cur.getCreationTime()));
308+
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue(cur.getCreationTime()));
309309
attr.addAttribute(Namespaces.EXIST_NS, "deduplicate-blobs", "deduplicate-blobs", "CDATA", Boolean.toString(deduplicateBlobs));
310310
attr.addAttribute(Namespaces.EXIST_NS, "version", "version", "CDATA", String.valueOf(BACKUP_FORMAT_VERSION));
311311

@@ -409,12 +409,12 @@ private void backup(final Set<String> seenBlobIds, final Collection current, fin
409409
Date date = ris.getCreationTime();
410410

411411
if (date != null) {
412-
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue(null, date));
412+
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", "" + new DateTimeValue(date));
413413
}
414414
date = ris.getLastModificationTime();
415415

416416
if (date != null) {
417-
attr.addAttribute(Namespaces.EXIST_NS, "modified", "modified", "CDATA", "" + new DateTimeValue(null, date));
417+
attr.addAttribute(Namespaces.EXIST_NS, "modified", "modified", "CDATA", "" + new DateTimeValue(date));
418418
}
419419

420420
attr.addAttribute(Namespaces.EXIST_NS, "filename", "filename", "CDATA", filename);

exist-core/src/main/java/org/exist/backup/SystemExport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public Path export(final String targetDir, boolean incremental, final int maxInc
216216
properties.setProperty(BackupDescriptor.INCREMENTAL_PROP_NAME, incremental ? "yes" : "no");
217217

218218
try {
219-
properties.setProperty(BackupDescriptor.DATE_PROP_NAME, new DateTimeValue(null, new Date()).getStringValue());
219+
properties.setProperty(BackupDescriptor.DATE_PROP_NAME, new DateTimeValue(new Date()).getStringValue());
220220
} catch (final XPathException e) {
221221
}
222222

@@ -400,7 +400,7 @@ private void export(final BackupHandler bh, final Collection current, final Back
400400
attr.addAttribute(Namespaces.EXIST_NS, "version", "version", "CDATA", String.valueOf(currVersion));
401401
Backup.writeUnixStylePermissionAttributes(attr, perm);
402402
try {
403-
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", new DateTimeValue(null, new Date(current.getCreated())).getStringValue());
403+
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", new DateTimeValue(new Date(current.getCreated())).getStringValue());
404404
} catch (final XPathException e) {
405405
e.printStackTrace();
406406
}
@@ -539,8 +539,8 @@ private void exportDocument(final BackupHandler bh, final BackupWriter output, f
539539
// main document info and could thus be damaged
540540

541541
try {
542-
final String created = new DateTimeValue(null, new Date(doc.getCreated())).getStringValue();
543-
final String modified = new DateTimeValue(null, new Date(doc.getLastModified())).getStringValue();
542+
final String created = new DateTimeValue(new Date(doc.getCreated())).getStringValue();
543+
final String modified = new DateTimeValue(new Date(doc.getLastModified())).getStringValue();
544544
attr.addAttribute(Namespaces.EXIST_NS, "created", "created", "CDATA", created);
545545
attr.addAttribute(Namespaces.EXIST_NS, "modified", "modified", "CDATA", modified);
546546
} catch (final XPathException e) {

exist-core/src/main/java/org/exist/backup/restore/AbstractRestoreHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private DeferredPermission restoreResourceEntry(final Attributes attributes) thr
352352
Date dateCreated = null;
353353
if (commonAttributes.created != null) {
354354
try {
355-
dateCreated = new DateTimeValue(null, commonAttributes.created).getDate();
355+
dateCreated = new DateTimeValue(commonAttributes.created).getDate();
356356
} catch (final XPathException xpe) {
357357
listener.warn("Illegal creation date. Ignoring date...");
358358
}
@@ -361,7 +361,7 @@ private DeferredPermission restoreResourceEntry(final Attributes attributes) thr
361361
Date dateModified = null;
362362
if (dateModifiedStr != null) {
363363
try {
364-
dateModified = new DateTimeValue(null, dateModifiedStr).getDate();
364+
dateModified = new DateTimeValue(dateModifiedStr).getDate();
365365
} catch (final XPathException xpe) {
366366
listener.warn("Illegal modification date. Ignoring date...");
367367
}
@@ -535,7 +535,7 @@ private Date getDateFromXSDateTimeStringForItem(final String strXSDateTime, fina
535535

536536
if (strXSDateTime != null) {
537537
try {
538-
dateCreated = new DateTimeValue(null, strXSDateTime).getDate();
538+
dateCreated = new DateTimeValue(strXSDateTime).getDate();
539539
} catch(final XPathException e2) {
540540
// no-op, ignore and move on
541541
}

exist-core/src/main/java/org/exist/collections/triggers/HistoryTrigger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private void makeCopy(final DBBroker broker, final Txn txn, final DocumentImpl d
9898
final XmldbURI path = rootPath.append(doc.getURI());
9999
try {
100100
//construct the destination document name
101-
String dtValue = new DateTimeValue(null, new Date(doc.getLastModified())).getStringValue();
101+
String dtValue = new DateTimeValue(new Date(doc.getLastModified())).getStringValue();
102102
dtValue = dtValue.replaceAll(":", "-"); // multiple ':' are not allowed in URI so use '-'
103103
dtValue = dtValue.replaceAll("\\.", "-"); // as we are using '-' instead of ':' do the same for '.'
104104
final XmldbURI name = XmldbURI.create(dtValue);

exist-core/src/main/java/org/exist/collections/triggers/XQueryTrigger.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -310,28 +310,28 @@ private void finish(final TriggerEvent event, final DBBroker broker, final Txn t
310310

311311
private void declareExternalVariables(final XQueryContext context, final TriggerPhase phase, final TriggerEvent event, final XmldbURI src, final XmldbURI dst, final boolean isCollection) throws XPathException {
312312
//declare external variables
313-
context.declareVariable(bindingPrefix + "type", new StringValue(null, phase.legacyPhaseName()));
314-
context.declareVariable(bindingPrefix + "event", new StringValue(null, event.legacyEventName()));
313+
context.declareVariable(bindingPrefix + "type", new StringValue(phase.legacyPhaseName()));
314+
context.declareVariable(bindingPrefix + "event", new StringValue(event.legacyEventName()));
315315
if (isCollection) {
316-
context.declareVariable(bindingPrefix + "collection", new AnyURIValue(null, src));
316+
context.declareVariable(bindingPrefix + "collection", new AnyURIValue(src));
317317
} else {
318-
context.declareVariable(bindingPrefix + "collection", new AnyURIValue(null, src.removeLastSegment()));
318+
context.declareVariable(bindingPrefix + "collection", new AnyURIValue(src.removeLastSegment()));
319319
}
320-
context.declareVariable(bindingPrefix + "uri", new AnyURIValue(null, src));
320+
context.declareVariable(bindingPrefix + "uri", new AnyURIValue(src));
321321
if (dst == null) {
322322
context.declareVariable(bindingPrefix + "new-uri", Sequence.EMPTY_SEQUENCE);
323323
} else {
324-
context.declareVariable(bindingPrefix + "new-uri", new AnyURIValue(null, dst));
324+
context.declareVariable(bindingPrefix + "new-uri", new AnyURIValue(dst));
325325
}
326326

327327
// For backward compatibility
328-
context.declareVariable(bindingPrefix + "eventType", new StringValue(null, phase.legacyPhaseName()));
329-
context.declareVariable(bindingPrefix + "triggerEvent", new StringValue(null, event.legacyEventName()));
328+
context.declareVariable(bindingPrefix + "eventType", new StringValue(phase.legacyPhaseName()));
329+
context.declareVariable(bindingPrefix + "triggerEvent", new StringValue(event.legacyEventName()));
330330
if (isCollection) {
331-
context.declareVariable(bindingPrefix + "collectionName", new AnyURIValue(null, src));
331+
context.declareVariable(bindingPrefix + "collectionName", new AnyURIValue(src));
332332
} else {
333-
context.declareVariable(bindingPrefix + "collectionName", new AnyURIValue(null, src.removeLastSegment()));
334-
context.declareVariable(bindingPrefix + "documentName", new AnyURIValue(null, src));
333+
context.declareVariable(bindingPrefix + "collectionName", new AnyURIValue(src.removeLastSegment()));
334+
context.declareVariable(bindingPrefix + "documentName", new AnyURIValue(src));
335335
}
336336

337337
//declare user defined parameters as external variables
@@ -340,7 +340,7 @@ private void declareExternalVariables(final XQueryContext context, final Trigger
340340
final String varName = (String) o;
341341
final String varValue = userDefinedVariables.getProperty(varName);
342342

343-
context.declareVariable(bindingPrefix + varName, new StringValue(null, varValue));
343+
context.declareVariable(bindingPrefix + varName, new StringValue(varValue));
344344
}
345345
}
346346
}
@@ -369,7 +369,7 @@ private CompiledXQuery getScript(final DBBroker broker, final Txn transaction) t
369369
final String varName = (String) o;
370370
final String varValue = userDefinedVariables.getProperty(varName);
371371

372-
context.declareVariable(bindingPrefix + varName, new StringValue(null, varValue));
372+
context.declareVariable(bindingPrefix + varName, new StringValue(varValue));
373373
}
374374
}
375375

@@ -427,15 +427,15 @@ private void execute(final TriggerPhase phase, final TriggerEvent event, final D
427427

428428
final List<Expression> args = new ArrayList<>(nParams);
429429
if (phase == TriggerPhase.BEFORE) {
430-
args.add(new LiteralValue(context, new AnyURIValue(null, src)));
430+
args.add(new LiteralValue(context, new AnyURIValue(src)));
431431
if (dst != null) {
432-
args.add(new LiteralValue(context, new AnyURIValue(null, dst)));
432+
args.add(new LiteralValue(context, new AnyURIValue(dst)));
433433
}
434434
} else {
435435
if (dst != null) {
436-
args.add(new LiteralValue(context, new AnyURIValue(null, dst)));
436+
args.add(new LiteralValue(context, new AnyURIValue(dst)));
437437
}
438-
args.add(new LiteralValue(context, new AnyURIValue(null, src)));
438+
args.add(new LiteralValue(context, new AnyURIValue(src)));
439439
}
440440

441441
service.execute(broker, compiledQuery, Tuple(functionName, args, Optional.empty()), null, null, true);

exist-core/src/main/java/org/exist/dom/memtree/CommentImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public String getStringValue() {
4444
}
4545

4646
public AtomicValue atomize() throws XPathException {
47-
return new StringValue(null, getData());
47+
return new StringValue(getData());
4848
}
4949

5050
@Override

exist-core/src/main/java/org/exist/dom/memtree/NodeImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ public AtomicValue convertTo(final int requiredType) throws XPathException {
569569

570570
@Override
571571
public AtomicValue atomize() throws XPathException {
572-
return new UntypedAtomicValue(null, getStringValue());
572+
return new UntypedAtomicValue(getStringValue());
573573
}
574574

575575
@Override
@@ -721,7 +721,7 @@ public <T> T toJavaObject(final Class<T> target) throws XPathException {
721721
if(target.isAssignableFrom(NodeImpl.class) || target.isAssignableFrom(Node.class) || target == Object.class) {
722722
return (T) this;
723723
} else {
724-
final StringValue v = new StringValue(null, getStringValue());
724+
final StringValue v = new StringValue(getStringValue());
725725
return v.toJavaObject(target);
726726
}
727727
}

exist-core/src/main/java/org/exist/dom/memtree/ProcessingInstructionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public String getNodeValue() throws DOMException {
6262

6363
@Override
6464
public AtomicValue atomize() throws XPathException {
65-
return new StringValue(null, getData());
65+
return new StringValue(getData());
6666
}
6767

6868
@Override

0 commit comments

Comments
 (0)