All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xapi.ui.autoui.impl.ToStringUserInterface Maven / Gradle / Ivy

Go to download

Everything needed to run a comprehensive dev environment. Just type X_ and pick a service from autocomplete; new dev modules will be added as they are built. The only dev service not included in the uber jar is xapi-dev-maven, as it includes all runtime dependencies of maven, adding ~4 seconds to build time, and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).

The newest version!
package xapi.ui.autoui.impl;

import java.io.IOException;

import xapi.ui.autoui.api.UiRenderingContext;

@SuppressWarnings("rawtypes")
public class ToStringUserInterface extends AbstractUserInterface implements Appendable{

  final StringBuilder b = new StringBuilder();
  
  @Override
  @SuppressWarnings("unchecked")
  protected void doRender(UiRenderingContext ctx, Object model) {
    recursiveRender(ctx, ctx.getRenderer(), model);
  }

  @Override
  public int hashCode() {
    return b.toString().hashCode();
  }
  
  @Override
  public String toString() {
    return b.toString();
  }
  
  @Override
  public boolean equals(Object obj) {
    return toString().equals(String.valueOf(obj));
  }

  @Override
  public Appendable append(CharSequence csq) throws IOException {
    b.append(csq);
    return this;
  }

  @Override
  public Appendable append(CharSequence csq, int start, int end)
      throws IOException {
    b.append(csq, start, end);
    return this;
  }

  @Override
  public Appendable append(char c) throws IOException {
    b.append(c);
    return this;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy