[core] Add convenience constructor to AbstractStreamOpen

Most of the times when we construct a stream-open-like element, we
want the jabber:client namespace. Hence add a constructor that does
select the namespace implicitly.
This commit is contained in:
Florian Schmaus 2020-08-26 11:36:55 +02:00
parent 2a9671ca93
commit e6a60213b6
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/**
*
* Copyright 2020 Aditya Borikar
* Copyright 2020 Florian Schmaus, Aditya Borikar
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -60,6 +60,10 @@ public abstract class AbstractStreamOpen implements Nonza {
*/
protected final String contentNamespace;
public AbstractStreamOpen(CharSequence to, CharSequence from, String id, String lang) {
this(to, from, id, lang, StreamContentNamespace.client);
}
public AbstractStreamOpen(CharSequence to, CharSequence from, String id, String lang, StreamContentNamespace ns) {
this.to = StringUtils.maybeToString(to);
this.from = StringUtils.maybeToString(from);