Skip to content

Commit

Permalink
[jxmpp-jid] Add JidCreate.entity(Bare|Full)From with CharSequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jul 14, 2024
1 parent 0670e96 commit 921f410
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions jxmpp-jid/src/main/java/org/jxmpp/jid/impl/JidCreate.java
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,18 @@ public static EntityBareJid entityBareFrom(Localpart localpart, Domainpart domai
return new LocalAndDomainpartJid(localpart, domain);
}

/**
* Get a {@link EntityBareJid} constructed from the given {@link Localpart} and {@link Domainpart}.
*
* @param localpart a localpart.
* @param domain a domainpart.
* @return a bare JID constructed from the given parts.
* @throws XmppStringprepException if an error occurs.
*/
public static EntityBareJid entityBareFrom(CharSequence localpart, Domainpart domain) throws XmppStringprepException {
return new LocalAndDomainpartJid(Localpart.fromUnescaped(localpart), domain);
}

/**
* Get a {@link EntityBareJid} from a given {@link CharSequence} or {@code null} if the input does not represent a JID.
*
Expand Down Expand Up @@ -1377,6 +1389,19 @@ public static EntityFullJid entityFullFrom(Localpart localpart, Domainpart domai
return entityFullFrom(entityBareFrom(localpart, domainpart), resource);
}

/**
* Get a {@link EntityFullJid} constructed from the given parts.
*
* @param localpart the localpart.
* @param domainpart the domainpart.
* @param resource the resourcepart.
* @return a full JID.
* @throws XmppStringprepException if an error occurs.
*/
public static EntityFullJid entityFullFrom(CharSequence localpart, Domainpart domainpart, CharSequence resource) throws XmppStringprepException {
return entityFullFrom(entityBareFrom(Localpart.fromUnescaped(localpart), domainpart), Resourcepart.from(resource));
}

/**
* Get a {@link EntityFullJid} constructed from a {@link EntityBareJid} and a {@link Resourcepart}.
*
Expand Down

0 comments on commit 921f410

Please sign in to comment.