mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-27 06:22:07 +01:00
Wip: Add first business classes
This commit is contained in:
parent
310a48f161
commit
1923d174e4
4 changed files with 99 additions and 2 deletions
|
@ -0,0 +1,5 @@
|
|||
package org.jivesoftware.smackx.mix.core;
|
||||
|
||||
public class MixChannel {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.jivesoftware.smackx.mix.core;
|
||||
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
||||
public class MixParticipant {
|
||||
|
||||
private EntityBareJid jid;
|
||||
private String nick;
|
||||
|
||||
public MixParticipant(EntityBareJid jid) {
|
||||
this(jid, null);
|
||||
}
|
||||
|
||||
public MixParticipant(EntityBareJid jid, String nick) {
|
||||
this.jid = jid;
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public EntityBareJid getJid() {
|
||||
return jid;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.jivesoftware.smackx.mix.core;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
public final class StableParticipantId implements CharSequence {
|
||||
|
||||
private final String id;
|
||||
|
||||
private StableParticipantId(String string) {
|
||||
String id = StringUtils.requireNotNullNorEmpty(string.trim(),
|
||||
"Stable Participant ID MUST NOT be null, nor empty.");
|
||||
if (id.contains("#") || id.contains("/") || id.contains("@")) {
|
||||
throw new IllegalArgumentException("Stable Participant ID MUST NOT contain the '#', '/' or '@' characters.");
|
||||
}
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return id.length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char charAt(int i) {
|
||||
return id.charAt(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence subSequence(int i, int i1) {
|
||||
return id.subSequence(i, i1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntStream chars() {
|
||||
return id.chars();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntStream codePoints() {
|
||||
return id.codePoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof StableParticipantId)) {
|
||||
return false;
|
||||
}
|
||||
return toString().equals(((StableParticipantId) obj).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@
|
|||
package org.jivesoftware.smackx.mix.core.provider;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -40,6 +39,5 @@ public class LeaveElementProviderTest {
|
|||
LeaveElement element = provider.parse(parser);
|
||||
|
||||
assertNotNull(element);
|
||||
assertTrue(element instanceof LeaveElement.V1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue