io.vertx.rxjava.ext.shell.term.Term 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.ext.shell.term;
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 terminal.
 *
 * 
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.shell.term.Term original} non RX-ified interface using Vert.x codegen.
 */
@RxGen(io.vertx.ext.shell.term.Term.class)
public class Term extends io.vertx.rxjava.ext.shell.term.Tty {
  @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;
    Term that = (Term) o;
    return delegate.equals(that.delegate);
  }
  
  @Override
  public int hashCode() {
    return delegate.hashCode();
  }
  public static final TypeArg __TYPE_ARG = new TypeArg<>(    obj -> new Term((io.vertx.ext.shell.term.Term) obj),
    Term::getDelegate
  );
  private final io.vertx.ext.shell.term.Term delegate;
  
  public Term(io.vertx.ext.shell.term.Term delegate) {
    super(delegate);
    this.delegate = delegate;
  }
  public Term(Object delegate) {
    super((io.vertx.ext.shell.term.Term)delegate);
    this.delegate = (io.vertx.ext.shell.term.Term)delegate;
  }
  public io.vertx.ext.shell.term.Term getDelegate() {
    return delegate;
  }
  public io.vertx.rxjava.ext.shell.term.Term resizehandler(io.vertx.core.Handler handler) { 
    delegate.resizehandler(handler);
    return this;
  }
  public io.vertx.rxjava.ext.shell.term.Term stdinHandler(io.vertx.core.Handler handler) { 
    delegate.stdinHandler(handler);
    return this;
  }
  public io.vertx.rxjava.ext.shell.term.Term write(java.lang.String data) { 
    delegate.write(data);
    return this;
  }
  /**
   * @return the last time this term received input
   */
  public long lastAccessedTime() { 
    long ret = delegate.lastAccessedTime();
    return ret;
  }
  /**
   * Echo some text in the terminal, escaped if necessary.
   * @param text the text to echo
   * @return a reference to this, so the API can be used fluently
   */
  public io.vertx.rxjava.ext.shell.term.Term echo(java.lang.String text) { 
    delegate.echo(text);
    return this;
  }
  /**
   * Associate the term with a session.
   * @param session the session to set
   * @return a reference to this, so the API can be used fluently
   */
  public io.vertx.rxjava.ext.shell.term.Term setSession(io.vertx.rxjava.ext.shell.session.Session session) { 
    io.vertx.rxjava.ext.shell.term.Term ret = io.vertx.rxjava.ext.shell.term.Term.newInstance((io.vertx.ext.shell.term.Term)delegate.setSession(session.getDelegate()));
    return ret;
  }
  /**
   * Set an interrupt signal handler on the term.
   * @param handler the interrupt handler
   * @return a reference to this, so the API can be used fluently
   */
  public io.vertx.rxjava.ext.shell.term.Term interruptHandler(io.vertx.rxjava.ext.shell.term.SignalHandler handler) { 
    delegate.interruptHandler(handler.getDelegate());
    return this;
  }
  /**
   * Set a suspend signal handler on the term.
   * @param handler the suspend handler
   * @return a reference to this, so the API can be used fluently
   */
  public io.vertx.rxjava.ext.shell.term.Term suspendHandler(io.vertx.rxjava.ext.shell.term.SignalHandler handler) { 
    delegate.suspendHandler(handler.getDelegate());
    return this;
  }
  /**
   * Prompt the user a line of text.
   * @param prompt the displayed prompt
   * @param lineHandler the line handler called with the line
   */
  public void readline(java.lang.String prompt, io.vertx.core.Handler lineHandler) { 
    delegate.readline(prompt, lineHandler);
  }
  /**
   * Prompt the user a line of text, providing a completion handler to handle user's completion.
   * @param prompt the displayed prompt
   * @param lineHandler the line handler called with the line
   * @param completionHandler the completion handler
   */
  public void readline(java.lang.String prompt, io.vertx.core.Handler lineHandler, io.vertx.core.Handler completionHandler) { 
    delegate.readline(prompt, lineHandler, new Handler() {
      public void handle(io.vertx.ext.shell.cli.Completion event) {
        completionHandler.handle(io.vertx.rxjava.ext.shell.cli.Completion.newInstance((io.vertx.ext.shell.cli.Completion)event));
      }
    });
  }
  /**
   * Set a handler that will be called when the terminal is closed.
   * @param handler the handler
   * @return a reference to this, so the API can be used fluently
   */
  public io.vertx.rxjava.ext.shell.term.Term closeHandler(io.vertx.core.Handler handler) { 
    delegate.closeHandler(handler);
    return this;
  }
  /**
   * Close the connection to terminal.
   */
  public void close() { 
    delegate.close();
  }
  public static Term newInstance(io.vertx.ext.shell.term.Term arg) {
    return arg != null ? new Term(arg) : null;
  }
}
            © 2015 - 2025 Weber Informatics LLC | Privacy Policy