Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.dyuproject.protostuff.compiler.java_bean.stg Maven / Gradle / Ivy
group java_bean : base;
map_value_prefix ::= [
"Int64": "new Long(",
"UInt64": "new Long(",
"SInt64": "new Long(",
"Fixed64": "new Long(",
"SFixed64": "new Long(",
"Float": "new Float(",
"Double": "new Double(",
"Bool": "new Boolean(",
"Bytes": "ByteString.bytesDefaultValue(\"",
"String": "ByteString.stringDefaultValue(\"",
"EnumField": ,
default: "new Integer("
]
map_value_suffix ::= [
"Int64": "l)",
"UInt64": "l)",
"SInt64": "l)",
"Fixed64": "l)",
"SFixed64": "l)",
"Float": "f)",
"Double": "d)",
"Bytes": "\")",
"String": "\")",
"EnumField": ,
default: ")"
]
map_primitive_wrapper ::= [
"int": "Integer",
"long": "Long",
"float": "Float",
"double": "Double",
"boolean": "Boolean",
default: key
]
map_primitive_number_suffix ::= [
"Int64": "l",
"UInt64": "l",
"SInt64": "l",
"Fixed64": "l",
"SFixed64": "l",
"Float": "f",
"Double": "d",
default:
]
//#enum begin
enum_block(eg, module, options, nested) ::= <<
public enum implements com.dyuproject.protostuff.EnumLite\<\>
{
()}; separator=",\n">;
public final int number;
private (int number)
{
this.number = number;
}
public int getNumber()
{
return number;
}
public static valueOf(int number)
{
switch(number)
{
default: return null;
}
}
}
>>
enum_header(eg, module, options) ::= <<
package ;
>>
enum_switch_case(value, options) ::= <<
case : return ;
>>
//#message begin
message_block(message, module, options, nested) ::= <<
public static final class
{
}
>>
message_header(message, module, options) ::= <<
package ;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
import com.dyuproject.protostuff.ByteString;
import com.dyuproject.protostuff.ByteString;
import com.dyuproject.protostuff.GraphIOUtil;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Message;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Pipe;
import com.dyuproject.protostuff.Schema;
import com.dyuproject.protostuff.UninitializedMessageException;
>>
message_impl_declaration(message, options) ::= <<
,
implements
Externalizable, Message\<\>, Schema\<\>
>>
message_default_instance(message, options) ::= <<
public static Schema\<\> getSchema()
{
return DEFAULT_INSTANCE;
}
public static getDefaultInstance()
{
return DEFAULT_INSTANCE;
}
static final DEFAULT_INSTANCE = new ();
>>
field_defaults_declaration(field, options) ::= <<
static final DEFAULT_ = ;
static final DEFAULT_ = ;
static final DEFAULT_ = ;
>>
field_default_value(field, options) ::= <<
>>
field_declaration(field, options, modifier) ::= <<
List\<\> ;
;
>>
field_singular_type(field, options) ::= <<
>>
field_assign_defaults(field, options) ::= <<
= DEFAULT_
>>
message_constructor(message, options) ::= <<
public ()
{
}
public (
)
{
}
>>
field_declare_constructor_singular(field, options) ::= <<
>>
field_assign_constructor_singular(field, options) ::= <<
this. = ;
>>
message_getters_and_setters(message, options) ::= <<
// getters and setters
>>
field_getters_and_setters(field, options, message) ::= <<
//
public List\<\> getList()
{
return ;
}
public setList(List\<\> )
{
this. = ;
}
public get(int index)
{
return == null ? null : .get(index);
}
public int getCount()
{
return == null ? 0 : .size();
}
public add( )
{
if(this. == null)
this. = new ArrayList\<\>();
this..add();
}
public get()
{
return ;
return == null ? : ;
return ;
}
public set( )
{
this. = ;
}
>>
builder_pattern_return_type(field, options, type) ::= <<
void
>>
builder_pattern_return(field, options) ::= <<
return this;
>>
message_impl_serializable(message, options) ::= <<
// java serialization
public void readExternal(ObjectInput in) throws IOException
{
GraphIOUtil.mergeDelimitedFrom(in, this, this);
}
public void writeExternal(ObjectOutput out) throws IOException
{
GraphIOUtil.writeDelimitedTo(out, this, this);
}
>>
message_impl_message(message, options) ::= <<
// message method
public Schema\<\> cachedSchema()
{
return DEFAULT_INSTANCE;
}
>>
message_impl_schema(message, options) ::= <<
// schema methods
public newMessage()
{
return new ();
}
public Class\<\> typeClass()
{
return .class;
}
public String messageName()
{
return .class.getSimpleName();
}
public String messageFullName()
{
return .class.getName();
}
>>
message_method_is_initialized(message, options) ::= <<
public boolean isInitialized( message)
{
return
;
}
public boolean isInitialized( message)
{
return true;
}
>>
field_is_initialized(field, options, name) ::= <<
. != null
>>
message_field_merge(message, options, name) ::= <<
public void mergeFrom(Input input, ) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
default:
input.handleUnknownField(number, this);
}
}
}
>>
field_merge_switch(field, options, name) ::= <<
case :
>>
singular_field_merge_switch(field, options, name) ::= <<
. = input.mergeObject(., .getSchema());
break;
. = .valueOf(input.readEnum());
break;
. = input.read();
break;
>>
repeated_field_merge_switch(field, options, name) ::= <<
if(. == null)
. = new ArrayList\<\>();
..add(input.mergeObject(null,