当前位置: 首页>>代码示例>>Java>>正文


Java Objects类代码示例

本文整理汇总了Java中org.jivesoftware.smack.util.Objects的典型用法代码示例。如果您正苦于以下问题:Java Objects类的具体用法?Java Objects怎么用?Java Objects使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Objects类属于org.jivesoftware.smack.util包,在下文中一共展示了Objects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendStanza

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
@Override
public void sendStanza(Stanza packet) throws NotConnectedException {
    Objects.requireNonNull(packet, "Packet must not be null");

    throwNotConnectedExceptionIfAppropriate();
    switch (fromMode) {
    case OMITTED:
        packet.setFrom(null);
        break;
    case USER:
        packet.setFrom(getUser());
        break;
    case UNCHANGED:
    default:
        break;
    }
    // Invoke interceptors for the new packet that is about to be sent. Interceptors may modify
    // the content of the packet.
    firePacketInterceptors(packet);
    sendStanzaInternal(packet);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:22,代码来源:AbstractXMPPConnection.java

示例2: getInstance

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public static synchronized AndroidSmackManager getInstance(Context context) {
	Objects.requireNonNull(context, "Context argument must not be null");
	if (INSTANCE == null) {
		INSTANCE = new AndroidSmackManager(context);
	}
	return INSTANCE;
}
 
开发者ID:Flowdalic,项目名称:android-xmpp-iot-demo,代码行数:8,代码来源:AndroidSmackManager.java

示例3: HostAddress

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
/**
 * Creates a new HostAddress with the given FQDN. The port will be set to the default XMPP client port: 5222
 * 
 * @param fqdn Fully qualified domain name.
 * @param port The port to connect on.
 * @throws IllegalArgumentException If the fqdn is null or port is out of valid range (0 - 65535).
 */
public HostAddress(String fqdn, int port) {
    Objects.requireNonNull(fqdn, "FQDN is null");
    if (port < 0 || port > 65535)
        throw new IllegalArgumentException(
                "Port must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + port);
    if (fqdn.charAt(fqdn.length() - 1) == '.') {
        this.fqdn = fqdn.substring(0, fqdn.length() - 1);
    }
    else {
        this.fqdn = fqdn;
    }
    this.port = port;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:21,代码来源:HostAddress.java

示例4: AbstractListFilter

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
/**
 * Creates an filter using the specified filters.
 *
 * @param filters the filters to add.
 */
protected AbstractListFilter(StanzaFilter... filters) {
    Objects.requireNonNull(filters, "Parameter must not be null.");
    for(StanzaFilter filter : filters) {
        Objects.requireNonNull(filter, "Parameter must not be null.");
    }
    this.filters = new ArrayList<StanzaFilter>(Arrays.asList(filters));
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:13,代码来源:AbstractListFilter.java

示例5: setIdentity

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
/**
 * Sets the default identity the client will report.
 *
 * @param identity
 */
public synchronized void setIdentity(Identity identity) {
    this.identity = Objects.requireNonNull(identity, "Identity can not be null");
    // Notify others of a state change of SDM. In order to keep the state consistent, this
    // method is synchronized
    renewEntityCapsVersion();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:12,代码来源:ServiceDiscoveryManager.java

示例6: AuthMechanism

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public AuthMechanism(String mechanism, String authenticationText) {
    this.mechanism = Objects.requireNonNull(mechanism, "SASL mechanism shouldn't be null.");
    this.authenticationText = StringUtils.requireNotNullOrEmpty(authenticationText,
                    "SASL authenticationText must not be null or empty (RFC6120 6.4.2)");
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:6,代码来源:SaslStreamElements.java

示例7: sendStanzaWithResponseCallback

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
@Override
public void sendStanzaWithResponseCallback(Stanza stanza, final StanzaFilter replyFilter,
                final StanzaListener callback, final ExceptionCallback exceptionCallback,
                long timeout) throws NotConnectedException {
    Objects.requireNonNull(stanza, "stanza must not be null");
    // While Smack allows to add PacketListeners with a PacketFilter value of 'null', we
    // disallow it here in the async API as it makes no sense
    Objects.requireNonNull(replyFilter, "replyFilter must not be null");
    Objects.requireNonNull(callback, "callback must not be null");

    final StanzaListener packetListener = new StanzaListener() {
        @Override
        public void processPacket(Stanza packet) throws NotConnectedException {
            try {
                XMPPErrorException.ifHasErrorThenThrow(packet);
                callback.processPacket(packet);
            }
            catch (XMPPErrorException e) {
                if (exceptionCallback != null) {
                    exceptionCallback.processException(e);
                }
            }
            finally {
                removeAsyncStanzaListener(this);
            }
        }
    };
    removeCallbacksService.schedule(new Runnable() {
        @Override
        public void run() {
            boolean removed = removeAsyncStanzaListener(packetListener);
            // If the packetListener got removed, then it was never run and
            // we never received a response, inform the exception callback
            if (removed && exceptionCallback != null) {
                exceptionCallback.processException(NoResponseException.newWith(AbstractXMPPConnection.this, replyFilter));
            }
        }
    }, timeout, TimeUnit.MILLISECONDS);
    addAsyncStanzaListener(packetListener, replyFilter);
    sendStanza(stanza);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:42,代码来源:AbstractXMPPConnection.java

示例8: Manager

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public Manager(XMPPConnection connection) {
    Objects.requireNonNull(connection, "XMPPConnection must not be null");

    weakConnection = new WeakReference<XMPPConnection>(connection);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:6,代码来源:Manager.java

示例9: setEncoder

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public static void setEncoder(Base64.Encoder encoder) {
    Objects.requireNonNull(encoder, "encoder must no be null");
    base64encoder = encoder;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:Base64.java

示例10: setEncoder

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public static void setEncoder(StringEncoder encoder) {
    Objects.requireNonNull(encoder, "encoder must no be null");
    base64UrlSafeEncoder = encoder;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:Base64UrlSafeEncoder.java

示例11: FlexibleStanzaTypeFilter

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
public FlexibleStanzaTypeFilter(Class<S> packetType) {
    this.stanzaType = Objects.requireNonNull(packetType, "Type must not be null");
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:4,代码来源:FlexibleStanzaTypeFilter.java

示例12: IQTypeFilter

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
private IQTypeFilter(IQ.Type type) {
       super(IQ.class);
	this.type = Objects.requireNonNull(type, "Type must not be null");
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:IQTypeFilter.java

示例13: PresenceTypeFilter

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
private PresenceTypeFilter(Presence.Type type) {
    super(Presence.class);
    this.type = Objects.requireNonNull(type, "type must not be null");
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:5,代码来源:PresenceTypeFilter.java

示例14: ErrorIQ

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
/**
 * Constructs a new error IQ.
 * <p>
 * According to RFC 6120 § 8.3.1 "4. An error stanza MUST contain an <error/> child element.", so the xmppError argument is mandatory.
 * </p>
 * @param xmppError the XMPPError (required).
 */
public ErrorIQ(XMPPError xmppError) {
    super(ELEMENT, null);
    Objects.requireNonNull(xmppError, "XMPPError must not be null");
    setType(IQ.Type.error);
    setError(xmppError);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:14,代码来源:ErrorIQ.java

示例15: getEntriesAndAddListener

import org.jivesoftware.smack.util.Objects; //导入依赖的package包/类
/**
 * Add a roster listener and invoke the roster entries with all entries of the roster.
 * <p>
 * The method guarantees that the listener is only invoked after
 * {@link RosterEntries#rosterEntires(Collection)} has been invoked, and that all roster events
 * that happen while <code>rosterEntires(Collection) </code> is called are queued until the
 * method returns.
 * </p>
 * <p>
 * This guarantee makes this the ideal method to e.g. populate a UI element with the roster while
 * installing a {@link RosterListener} to listen for subsequent roster events.
 * </p>
 *
 * @param rosterListener the listener to install
 * @param rosterEntries the roster entries callback interface
 * @since 4.1
 */
public void getEntriesAndAddListener(RosterListener rosterListener, RosterEntries rosterEntries) {
    Objects.requireNonNull(rosterListener, "listener must not be null");
    Objects.requireNonNull(rosterEntries, "rosterEntries must not be null");

    synchronized (rosterListenersAndEntriesLock) {
        rosterEntries.rosterEntires(entries.values());
        addRosterListener(rosterListener);
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:27,代码来源:Roster.java


注:本文中的org.jivesoftware.smack.util.Objects类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。