mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-26 06:07:59 +01:00
Add TypedCloneable
This commit is contained in:
parent
429af3b642
commit
e85c1881d7
4 changed files with 42 additions and 5 deletions
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jivesoftware.smack.util.TypedCloneable;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
*
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
public final class Message extends Stanza implements Cloneable {
|
||||
public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||
|
||||
public static final String ELEMENT = "message";
|
||||
public static final String BODY = "body";
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jivesoftware.smack.packet;
|
|||
import java.util.Locale;
|
||||
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.TypedCloneable;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +56,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
*
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
public final class Presence extends Stanza implements Cloneable {
|
||||
public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||
|
||||
public static final String ELEMENT = "presence";
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.util;
|
||||
|
||||
/**
|
||||
* An extended version of {@link java.lang.Cloneable}, which defines a generic {@link #clone()}
|
||||
* method.
|
||||
*
|
||||
* @param <T> the type returned by {@link #clone()}.
|
||||
*/
|
||||
public interface TypedCloneable<T> extends Cloneable {
|
||||
|
||||
/**
|
||||
* Clone this instance.
|
||||
*
|
||||
* @return a cloned version of this instance.
|
||||
*/
|
||||
public T clone();
|
||||
|
||||
}
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.disco.packet;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.TypedCloneable;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
import org.jxmpp.util.XmppStringUtils;
|
||||
|
||||
|
@ -38,7 +39,7 @@ import java.util.Set;
|
|||
*
|
||||
* @author Gaston Dombiak
|
||||
*/
|
||||
public class DiscoverInfo extends IQ implements Cloneable {
|
||||
public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
||||
|
||||
public static final String ELEMENT = QUERY_ELEMENT;
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/disco#info";
|
||||
|
@ -266,7 +267,7 @@ public class DiscoverInfo extends IQ implements Cloneable {
|
|||
* attributes.
|
||||
*
|
||||
*/
|
||||
public static class Identity implements Comparable<Identity>, Cloneable {
|
||||
public static class Identity implements Comparable<Identity>, TypedCloneable<Identity> {
|
||||
|
||||
private final String category;
|
||||
private final String type;
|
||||
|
@ -473,7 +474,7 @@ public class DiscoverInfo extends IQ implements Cloneable {
|
|||
* as well as specific feature types of interest, if any (e.g., for the purpose of feature
|
||||
* negotiation).
|
||||
*/
|
||||
public static class Feature implements Cloneable {
|
||||
public static class Feature implements TypedCloneable<Feature> {
|
||||
|
||||
private final String variable;
|
||||
|
||||
|
|
Loading…
Reference in a new issue