1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.xmpp
;
6 * Builder used to generate {@link Presence} instances to represent
7 * incoming XMPP presence stanzas.
10 public class PresenceBuilder
{
12 private PresenceType presenceType
;
13 private PresenceShow presenceShow
;
14 private String status
;
17 private String stanza
;
18 private boolean valid
;
20 public PresenceBuilder
withPresenceType(PresenceType presenceType
) {
21 this.presenceType
= presenceType
;
25 public PresenceBuilder
withPresenceShow(PresenceShow presenceShow
) {
26 this.presenceShow
= presenceShow
;
30 public PresenceBuilder
withStatus(String status
) {
35 public PresenceBuilder
withFromJid(JID fromJid
) {
36 this.fromJid
= fromJid
;
40 public PresenceBuilder
withToJid(JID toJid
) {
45 PresenceBuilder
withStanza(String stanza
) {
50 PresenceBuilder
withValid(boolean valid
) {
55 public Presence
build() {
56 if (this.presenceType
== null) {
57 throw new IllegalArgumentException("Must have a type");
60 return new Presence(presenceType
, presenceShow
, status
, toJid
, fromJid
, stanza
, valid
);