alef 0.107.9

Opinionated polyglot binding generator for Rust libraries
Documentation
// DO NOT EDIT - auto-generated by alef
package {{ package }};

{% if doc %}
/**
{% for line in doc_lines %}
 * {{ line }}
{% endfor %}
 */
{% else %}
/** Base exception for {{ base_name }}. */
{% endif %}
public class {{ base_name }} extends {{ main_class }}Exception {
  private static final long serialVersionUID = 1L;
{% if has_methods %}
{% for m in methods %}
  /** {{ m.field_name | default('Introspection field') }}.{% if m.nullable %} {@code null} when the error carries none.{% endif %} */
  private final {{ m.java_type }} {{ m.field_name }};
{% endfor %}

  /** Creates a new {{ base_name }} with the given message. */
  public {{ base_name }}(final String message) {
    super(message);
{% for m in methods %}
    this.{{ m.field_name }} = {{ m.default_value }};
{% endfor %}
  }

  /** Creates a new {{ base_name }} with the given message and cause. */
  public {{ base_name }}(final String message, final Throwable cause) {
    super(message, cause);
{% for m in methods %}
    this.{{ m.field_name }} = {{ m.default_value }};
{% endfor %}
  }

{% if legacy_ctor_methods %}
  /** Creates a new {{ base_name }} with the given message and its introspection fields. */
  public {{ base_name }}(final String message{% for m in legacy_ctor_methods %}, final {{ m.java_type }} {{ m.field_name }}{% endfor %}) {
    super(message);
{% for m in methods %}
{% if m.is_duration %}
    this.{{ m.field_name }} = {{ m.default_value }};
{% else %}
    this.{{ m.field_name }} = {{ m.field_name }};
{% endif %}
{% endfor %}
  }
{% endif %}
{% if has_duration_methods %}

  /** Creates a new {{ base_name }} with the given message and every introspection field, including durations. */
  public {{ base_name }}(final String message{% for m in methods %}, final {{ m.java_type }} {{ m.field_name }}{% endfor %}) {
    super(message);
{% for m in methods %}
    this.{{ m.field_name }} = {{ m.field_name }};
{% endfor %}
  }
{% endif %}
{% for m in methods %}

{% if m.doc %}  /** {{ m.doc }} */
{% else %}  /** Returns the {{ m.field_name }} for this error. */
{% endif %}  public {{ m.java_type }} {{ m.getter_name }}() { return this.{{ m.field_name }}; }
{% endfor %}
{% else %}
  /** Creates a new {{ base_name }} with the given message. */
  public {{ base_name }}(final String message) {
    super(message);
  }

  /** Creates a new {{ base_name }} with the given message and cause. */
  public {{ base_name }}(final String message, final Throwable cause) {
    super(message, cause);
  }
{% endif %}
}