96 lines
3.6 KiB
Twig
96 lines
3.6 KiB
Twig
{%- set hasParent = parent is not null -%}
|
|
/**
|
|
* This code is autogenerated by Touch Instinct tools
|
|
*/
|
|
package {{ packageName }}.api;
|
|
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.Nullable;
|
|
|
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
|
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
|
|
import java.util.List;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.HashMap;
|
|
|
|
import org.joda.time.DateTime;
|
|
|
|
import ru.touchin.templates.ApiModel;
|
|
import ru.touchin.roboswag.core.utils.ObjectUtils;
|
|
import ru.touchin.templates.logansquare.LoganSquareJsonModel;
|
|
|
|
/**
|
|
* {{ description }}
|
|
*/
|
|
@JsonObject(serializeNullObjects = true)
|
|
public class {% include 'blocks/class/classtype.twig' with { type: type } %} extends {% include 'blocks/class/supertype.twig' with { type: type, parent: parent } %} {
|
|
{% include 'blocks/class/fields.twig' with { fields: fields } %}
|
|
public {{ type.baseTypeName }}() {
|
|
super();
|
|
}
|
|
{% if (allFieldsOrdered is not empty) %}
|
|
//TODO: if TItems instance of arrayList then new ArrayList
|
|
public {{ type.baseTypeName }}({%- include 'blocks/class/init-parameters-fields.twig' with { fields: allFieldsOrdered } -%}) {
|
|
super({%- include 'blocks/class/fields-super-initialization.twig' with { fields: superclassesFields } -%});
|
|
{%- include 'blocks/class/fields-initialization.twig' with { fields: fields, object: "this" } %}
|
|
}
|
|
{% endif %}
|
|
{%- include 'blocks/class/fields-getters-setters.twig' with { fields: fields } %}
|
|
|
|
//TODO: add check for collection if TypeParameter
|
|
//TODO: do not validate enums as ApiModel
|
|
@Override
|
|
public void validate() throws ValidationException {
|
|
super.validate();
|
|
{%- include 'blocks/class/fields-validate.twig' with { fields: fields } %}
|
|
}
|
|
|
|
protected void copyTo(@NonNull final {% include 'blocks/class/classtype.twig' with { type: type } %} destination) {
|
|
{%- if parent is not null %}
|
|
super.copyTo(destination);
|
|
{%- endif %}
|
|
{%- include 'blocks/class/fields-initialization.twig' with { fields: fields, object: "destination" } %}
|
|
}
|
|
|
|
@NonNull
|
|
public {% include 'blocks/class/classtype.twig' with { type: type } %} copy() {
|
|
final {% include 'blocks/class/classtype.twig' with { type: type } %} result = new {% include 'blocks/class/classtype.twig' with { type: type } %}();
|
|
this.copyTo(result);
|
|
return result;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return ObjectUtils.hashCode({%- if parent is not null -%}super.hashCode(), {% endif -%}{%- include 'blocks/class/fields-super-initialization.twig' with { fields: fields } -%});
|
|
}
|
|
|
|
public boolean equals(@Nullable final Object object) {
|
|
if (this == object) {
|
|
return true;
|
|
}
|
|
if (object == null || getClass() != object.getClass()) {
|
|
return false;
|
|
}
|
|
final {% include 'blocks/class/classtype.twig' with { type: type } %} that = ({% include 'blocks/class/classtype.twig' with { type: type } %}) object;
|
|
return {% if parent is not null -%}super.equals(that)
|
|
&& {% endif -%}
|
|
{%- include 'blocks/class/fields-equals.twig' with { fields: fields } -%};
|
|
}
|
|
|
|
private void writeObject(@NonNull final ObjectOutputStream outputStream) throws IOException {
|
|
{%- include 'blocks/class/fields-write-object.twig' with { fields: fields } %}
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
private void readObject(@NonNull final ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
|
|
{%- include 'blocks/class/fields-read-object.twig' with { fields: fields } %}
|
|
}
|
|
|
|
} |