MUCLightConfigurationIQ.java

  1. /**
  2.  *
  3.  * Copyright 2016 Fernando Ramirez
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jivesoftware.smackx.muclight.element;

  18. import org.jivesoftware.smack.packet.IQ;

  19. import org.jivesoftware.smackx.muclight.MUCLightRoomConfiguration;
  20. import org.jivesoftware.smackx.muclight.MultiUserChatLight;
  21. import org.jivesoftware.smackx.muclight.element.MUCLightElements.ConfigurationElement;

  22. /**
  23.  * MUC Light configuration response IQ class.
  24.  *
  25.  * @author Fernando Ramirez
  26.  *
  27.  */
  28. public class MUCLightConfigurationIQ extends IQ {

  29.     public static final String ELEMENT = QUERY_ELEMENT;
  30.     public static final String NAMESPACE = MultiUserChatLight.NAMESPACE + MultiUserChatLight.CONFIGURATION;

  31.     private final String version;
  32.     private final MUCLightRoomConfiguration configuration;

  33.     /**
  34.      * MUC Light configuration response IQ constructor.
  35.      *
  36.      * @param version TODO javadoc me please
  37.      * @param configuration TODO javadoc me please
  38.      */
  39.     public MUCLightConfigurationIQ(String version, MUCLightRoomConfiguration configuration) {
  40.         super(ELEMENT, NAMESPACE);
  41.         this.version = version;
  42.         this.configuration = configuration;
  43.     }

  44.     @Override
  45.     protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
  46.         xml.rightAngleBracket();
  47.         xml.optElement("version", version);
  48.         xml.append(new ConfigurationElement(configuration));
  49.         return xml;
  50.     }

  51.     /**
  52.      * Returns the version.
  53.      *
  54.      * @return the version
  55.      */
  56.     public String getVersion() {
  57.         return version;
  58.     }

  59.     /**
  60.      * Returns the room configuration.
  61.      *
  62.      * @return the configuration of the room
  63.      */
  64.     public MUCLightRoomConfiguration getConfiguration() {
  65.         return configuration;
  66.     }

  67. }