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

templates.java.common.st Maven / Gradle / Ivy

service(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.facebook.swift.service.*;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.*;
import java.util.*;

@ThriftService("")
public interface  extends 
{
    @ThriftService("")
    public interface Async extends 
    {
        }; separator="\n">
    }
    }; separator="\n">
}
>>

struct(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.facebook.swift.codec.ThriftField.Recursiveness;
import java.util.*;

import static com.google.common.base.MoreObjects.toStringHelper;

@ThriftStruct("")
public final class 
{
    <_structbody(context)>

    <_toString(context)>

    <_equalsImpl(context)>

    <_hashCodeImpl(context)>
}<\n>
>>

union(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.facebook.swift.codec.ThriftField.Recursiveness;
import java.util.*;

import static com.google.common.base.MoreObjects.toStringHelper;

@ThriftUnion("")
public final class 
{
    <_union_body(context)>

    }; separator="\n\n">

    @ThriftUnionId
    public int getThriftId()
    {
        return this.id;
    }

    public String getThriftName()
    {
        return this.name;
    }

    <_union_toString(context)>
}<\n>
>>

exception(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.facebook.swift.codec.ThriftField.Recursiveness;
import java.util.*;

@ThriftStruct("")
public final class  extends RuntimeExceptionException
{
    private static final long serialVersionUID = 1L;

    <_structbody(context)>
}<\n>
>>

constants(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;
import com.google.common.collect.*;
import java.util.*;

public final class 
{
    private () {
    }

    }; separator="\n\n">
}<\n>
>>



stringEnum(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;

public enum 
{
    }; separator=", ">;
}<\n>
>>

intEnum(context, tweaks) ::= <<







package ;

import com.facebook.swift.codec.*;

public enum 
{
    }; separator=", ">;

    private final int value;

    (int value)
    {
        this.value = value;
    }

    @ThriftEnumValue
    public int getValue()
    {
        return value;
    }
}<\n>
>>

_enumElement(field) ::= <<
()
>>

_method(method) ::= <<

@ThriftMethod(value = "",
              oneway = true,
              exception = {
                  <_annotatedExceptions(method)>
              })

 <_params(method.parameters)>;
 throws }; separator=", ">;
>>

_asyncMethod(method) ::= <<

@ThriftMethod(value = "",
              oneway = true,
              exception = {
                  <_annotatedExceptions(method)>
              })

ListenableFuture\<\> <_params(method.parameters)>;
>>

_annotatedExceptions(method) ::= <<
}; separator=",\n">
>>

_fieldAnnotation(field) ::= <<
@ThriftField(value=, name="", requiredness=Requiredness., isLegacyId=true<_idlAnnotations(field)>, isRecursive=Recursiveness.TRUE)
>>

_idlAnnotations(field) ::= <<
, idlAnnotations = { }; separator=", "> }
>>

_idlAnnotation(annotation) ::= <<
@ThriftIdlAnnotation(key = "", value = "")
>>

_params(parameters) ::= <<
(
    }; separator=",\n">
)()
>>

_param(param) ::= <<
<_fieldAnnotation(param)> final  
>>

_exceptionElement(exception) ::= <<
@ThriftException(type=.class, id=)
>>

_constantElement(constant) ::= <<
public static final   = ;
>>

_toString(context) ::= <<
@Override
public String toString()
{
    return toStringHelper(this)
        }; separator="\n">
        .toString();
}
>>

_toStringField(field) ::= <<
.add("", )
>>

_hashCodeImpl(context) ::= <<
@Override
public int hashCode() {
    return Arrays.deepHashCode(new Object[] {
        }; separator = ",\n">
    });
}
>>

_equalsImpl(context) ::= <<
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

     other = ()o;

    return
        }; separator=" &&\n">true;
}
>>

_checkFieldEquality(field) ::= <<
<_checkArrayFieldEquality(field)><_checkObjectFieldEquality(field)>
>>

_checkArrayFieldEquality(field) ::= <<
Arrays.equals(, other.)
>>

_checkObjectFieldEquality(field) ::= <<
Objects.equals(, other.)
>>

_union_field(field) ::= <<
<_fieldAnnotation(field)>
public  () {
    if (this.id != ) {
        throw new IllegalStateException("Not a  element!");
    }
    return () value;
}

public boolean () {
    return this.id == ;
}
>>

_union_toString(context) ::= <<
@Override
public String toString()
{
    return toStringHelper(this)
        .add("value", value)
        .add("id", id)
        .add("name", name)
        .add("type", value == null ? "\" : value.getClass().getSimpleName())
        .toString();
}
>>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy