io.vertx.rxjava.core.net.SocketAddress Maven / Gradle / Ivy
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you 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 io.vertx.rxjava.core.net;
import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
/**
 * The address of a socket, an inet socket address or a domain socket address.
 * 
 * Use {@link io.vertx.rxjava.core.net.SocketAddress#inetSocketAddress} to create an inet socket address and {@link io.vertx.rxjava.core.net.SocketAddress#domainSocketAddress}
 * to create a domain socket address
 *
 * 
 * NOTE: This class has been automatically generated from the {@link io.vertx.core.net.SocketAddress original} non RX-ified interface using Vert.x codegen.
 */
@RxGen(io.vertx.core.net.SocketAddress.class)
public class SocketAddress {
  @Override
  public String toString() {
    return delegate.toString();
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    SocketAddress that = (SocketAddress) o;
    return delegate.equals(that.delegate);
  }
  
  @Override
  public int hashCode() {
    return delegate.hashCode();
  }
  public static final TypeArg __TYPE_ARG = new TypeArg<>(    obj -> new SocketAddress((io.vertx.core.net.SocketAddress) obj),
    SocketAddress::getDelegate
  );
  private final io.vertx.core.net.SocketAddress delegate;
  
  public SocketAddress(io.vertx.core.net.SocketAddress delegate) {
    this.delegate = delegate;
  }
  public SocketAddress(Object delegate) {
    this.delegate = (io.vertx.core.net.SocketAddress)delegate;
  }
  public io.vertx.core.net.SocketAddress getDelegate() {
    return delegate;
  }
  /**
   * Create a inet socket address, host must be non null and port must be between 0
   * and 65536.
   * 
   * The host string can be an host name or an host address.
   * 
   * No name resolution will be attempted.
   * @param port the port
   * @param host the host
   * @return the created socket address
   */
  public static io.vertx.rxjava.core.net.SocketAddress inetSocketAddress(int port, java.lang.String host) { 
    io.vertx.rxjava.core.net.SocketAddress ret = io.vertx.rxjava.core.net.SocketAddress.newInstance((io.vertx.core.net.SocketAddress)io.vertx.core.net.SocketAddress.inetSocketAddress(port, host));
    return ret;
  }
  /**
   * Create a domain socket address from a path.
   * @param path the address path
   * @return the created socket address
   */
  public static io.vertx.rxjava.core.net.SocketAddress domainSocketAddress(java.lang.String path) { 
    io.vertx.rxjava.core.net.SocketAddress ret = io.vertx.rxjava.core.net.SocketAddress.newInstance((io.vertx.core.net.SocketAddress)io.vertx.core.net.SocketAddress.domainSocketAddress(path));
    return ret;
  }
  /**
   * Returns the host name when available or the IP address in string representation.
   * 
   * Domain socket address returns null.
   * @return the host address
   */
  public java.lang.String host() { 
    if (cached_0 != null) {
      return cached_0;
    }
    java.lang.String ret = delegate.host();
    cached_0 = ret;
    return ret;
  }
  /**
   * Returns the host name when available or null
   * 
   * Domain socket address returns null.
   * @return the host name
   */
  public java.lang.String hostName() { 
    if (cached_1 != null) {
      return cached_1;
    }
    java.lang.String ret = delegate.hostName();
    cached_1 = ret;
    return ret;
  }
  /**
   * Returns the host IP address when available or null as a String.
   * 
   * Domain socket address returns null.
   * @return the host address
   */
  public java.lang.String hostAddress() { 
    if (cached_2 != null) {
      return cached_2;
    }
    java.lang.String ret = delegate.hostAddress();
    cached_2 = ret;
    return ret;
  }
  /**
   * @return the address port or -1 for a domain socket
   */
  public int port() { 
    if (cached_3 != null) {
      return cached_3;
    }
    int ret = delegate.port();
    cached_3 = ret;
    return ret;
  }
  /**
   * @return the domain socket path or null for a inet socket address.
   */
  public java.lang.String path() { 
    if (cached_4 != null) {
      return cached_4;
    }
    java.lang.String ret = delegate.path();
    cached_4 = ret;
    return ret;
  }
  /**
   * @return true for an inet socket address
   */
  public boolean isInetSocket() { 
    if (cached_5 != null) {
      return cached_5;
    }
    boolean ret = delegate.isInetSocket();
    cached_5 = ret;
    return ret;
  }
  /**
   * @return true for an domain socket address
   */
  public boolean isDomainSocket() { 
    if (cached_6 != null) {
      return cached_6;
    }
    boolean ret = delegate.isDomainSocket();
    cached_6 = ret;
    return ret;
  }
  /**
   * Create a inet socket address from a Java .
   * 
   * No name resolution will be attempted.
   * @param address the address
   * @return the created socket address
   */
  public static io.vertx.rxjava.core.net.SocketAddress inetSocketAddress(java.net.InetSocketAddress address) { 
    io.vertx.rxjava.core.net.SocketAddress ret = io.vertx.rxjava.core.net.SocketAddress.newInstance((io.vertx.core.net.SocketAddress)io.vertx.core.net.SocketAddress.inetSocketAddress(address));
    return ret;
  }
  private java.lang.String cached_0;
  private java.lang.String cached_1;
  private java.lang.String cached_2;
  private java.lang.Integer cached_3;
  private java.lang.String cached_4;
  private java.lang.Boolean cached_5;
  private java.lang.Boolean cached_6;
  public static SocketAddress newInstance(io.vertx.core.net.SocketAddress arg) {
    return arg != null ? new SocketAddress(arg) : null;
  }
}
     © 2015 - 2025 Weber Informatics LLC | Privacy Policy