Ejemplo n.º 1
0
			/**
         * Converts a String value into its Type representation.
         *
         * @param type the String value.
         * @return the type corresponding to the String.
         */
			public static Type fromXMPP(String type) {
				if (type == null) {
					throw new NullPointerException();
				}
				type = type.toLowerCase();
				if (bool_type.toXMPP().equals(type)) {
					return bool_type;
				}
				else if (@fixed.toXMPP().equals(type)) {
					return @fixed;
				}
				else if (hidden.toXMPP().equals(type)) {
					return hidden;
				}
				else if (jid_multi.toXMPP().equals(type)) {
					return jid_multi;
				}
				else if (jid_single.toXMPP().equals(type)) {
					return jid_single;
				}
				else if (list_multi.toXMPP().equals(type)) {
					return list_multi;
				}
				else if (list_single.toXMPP().equals(type)) {
					return list_single;
				}
				else if (text_multi.toXMPP().equals(type)) {
					return text_multi;
				}
				else if (text_private.toXMPP().equals(type)) {
					return text_private;
				}
				else if (text_single.toXMPP().equals(type)) {
					return text_single;
				}
				else {
					throw new IllegalArgumentException("Type invalid:" + type);
				}
			}
Ejemplo n.º 2
0
			/**
         * Converts a String value into its Condition representation.
         *
         * @param condition the String value.
         * @return the condition corresponding to the String.
         */
			public static Condition fromXMPP(String condition) {
				if (condition == null) {
					throw new NullPointerException();
				}
				condition = condition.toLowerCase();
				if (bad_format.toXMPP().equals(condition)) {
					return bad_format;
				}
				else if (bad_namespace_prefix.toXMPP().equals(condition)) {
					return bad_namespace_prefix;
				}
				else if (conflict.toXMPP().equals(condition)) {
					return conflict;
				}
				else if (connection_timeout.toXMPP().equals(condition)) {
					return connection_timeout;
				}
				else if (host_gone.toXMPP().equals(condition)) {
					return host_gone;
				}
				else if (host_unknown.toXMPP().equals(condition)) {
					return host_unknown;
				}
				else if (improper_addressing.toXMPP().equals(condition)) {
					return improper_addressing;
				}
				else if (internal_server_error.toXMPP().equals(condition)) {
					return internal_server_error;
				}
				else if (invalid_from.toXMPP().equals(condition)) {
					return invalid_from;
				}
				else if (invalid_id.toXMPP().equals(condition)) {
					return invalid_id;
				}
				else if (invalid_namespace.toXMPP().equals(condition)) {
					return invalid_namespace;
				}
				else if (invalid_xml.toXMPP().equals(condition)) {
					return invalid_xml;
				}
				else if (not_authorized.toXMPP().equals(condition)) {
					return not_authorized;
				}
				else if (policy_violation.toXMPP().equals(condition)) {
					return policy_violation;
				}
				else if (remote_connection_failed.toXMPP().equals(condition)) {
					return remote_connection_failed;
				}
				else if (resource_constraint.toXMPP().equals(condition)) {
					return resource_constraint;
				}
				else if (restricted_xml.toXMPP().equals(condition)) {
					return restricted_xml;
				}
				else if (see_other_host.toXMPP().equals(condition)) {
					return see_other_host;
				}
				else if (system_shutdown.toXMPP().equals(condition)) {
					return system_shutdown;
				}
				else if (undefined_condition.toXMPP().equals(condition)) {
					return undefined_condition;
				}
				else if (unsupported_encoding.toXMPP().equals(condition)) {
					return unsupported_encoding;
				}
				else if (unsupported_stanza_type.toXMPP().equals(condition)) {
					return unsupported_stanza_type;
				}
				else if (unsupported_version.toXMPP().equals(condition)) {
					return unsupported_version;
				}
				else if (xml_not_well_formed.toXMPP().equals(condition)) {
					return xml_not_well_formed;
				}
				else {
					throw new IllegalArgumentException("Condition invalid:" + condition);
				}
			}
Ejemplo n.º 3
0
			/**
         * Converts a String value into its Condition representation.
         *
         * @param condition the String value.
         * @return the condition corresponding to the String.
         */
			public static Condition fromXMPP(String condition) {
				if (condition == null) {
					throw new NullPointerException();
				}
				condition = condition.toLowerCase();
				if (bad_request.toXMPP().equals(condition)) {
					return bad_request;
				}
				else if (conflict.toXMPP().equals(condition)) {
					return conflict;
				}
				else if (feature_not_implemented.toXMPP().equals(condition)) {
					return feature_not_implemented;
				}
				else if (forbidden.toXMPP().equals(condition)) {
					return forbidden;
				}
				else if (gone.toXMPP().equals(condition)) {
					return gone;
				}
				else if (internal_server_error.toXMPP().equals(condition)) {
					return internal_server_error;
				}
				else if (item_not_found.toXMPP().equals(condition)) {
					return item_not_found;
				}
				else if (jid_malformed.toXMPP().equals(condition)) {
					return jid_malformed;
				}
				else if (not_acceptable.toXMPP().equals(condition)) {
					return not_acceptable;
				}
				else if (not_allowed.toXMPP().equals(condition)) {
					return not_allowed;
				}
				else if (not_authorized.toXMPP().equals(condition)) {
					return not_authorized;
				}
				else if (payment_required.toXMPP().equals(condition)) {
					return payment_required;
				}
				else if (recipient_unavailable.toXMPP().equals(condition)) {
					return recipient_unavailable;
				}
				else if (redirect.toXMPP().equals(condition)) {
					return redirect;
				}
				else if (registration_required.toXMPP().equals(condition)) {
					return registration_required;
				}
				else if (remote_server_not_found.toXMPP().equals(condition)) {
					return remote_server_not_found;
				}
				else if (remote_server_timeout.toXMPP().equals(condition)) {
					return remote_server_timeout;
				}
				else if (resource_constraint.toXMPP().equals(condition)) {
					return resource_constraint;
				}
				else if (service_unavailable.toXMPP().equals(condition)) {
					return service_unavailable;
				}
				else if (subscription_required.toXMPP().equals(condition)) {
					return subscription_required;
				}
				else if (undefined_condition.toXMPP().equals(condition)) {
					return undefined_condition;
				}
				else if (unexpected_request.toXMPP().equals(condition)) {
					return unexpected_request;
				}
				else {
					throw new IllegalArgumentException("Condition invalid:" + condition);
				}
			}