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

io.protostuff.generator.java.schema.stg Maven / Gradle / Ivy

There is a newer version: 3.1.40
Show newest version
delimiters "<", ">"

schema(message) ::= <<
public static final class Schema implements io.protostuff.Schema\<\>{

    private static final Schema INSTANCE = new Schema();

    private static final java.util.Map\ __fieldMap = new java.util.HashMap\<>();

    static {
    	
    }

    @Override
    public  newMessage() {
        return new ();
    }

    @Override
    public Class\<\> typeClass() {
        return .class;
    }

    @Override
    public String messageName() {
        return .class.getSimpleName();
    }

    @Override
    public String messageFullName() {
        return .class.getName();
    }

    @Override
    @Deprecated
    public boolean isInitialized( message) {
        return true;
    }

    @Override
    public void mergeFrom(io.protostuff.Input input,  instance) throws java.io.IOException {
    	if (instance.__merge_lock) {
    		throw new IllegalStateException("Cannot reuse message instance");
    	} else {
    		instance.__merge_lock = true;
    	}
    	while(true) {
    		int number = input.readFieldNumber(this);
            if (number == 0) {
                break;
            }
            switch(number) {
                
                default:
                    input.handleUnknownField(number, this);
            }
    	}
        
    }

    @Override
    public void writeTo(io.protostuff.Output output,  instance) throws java.io.IOException {
        
    }

    @Override
    public String getFieldName(int number) {
    	switch(number) {
    		
    		default: return null;
    	}
    }

    @Override
    public int getFieldNumber(String name) {
    	final Integer number = __fieldMap.get(name);
    	return number == null ? 0 : number.intValue();
    }

}
>>

make_unmodifiable(field) ::= <<

if((instance. & ) == ) {
    instance. = java.util.Collections.unmodifiableMap(instance.);
}

if((instance. & ) == ) {
    instance. = java.util.Collections.unmodifiableList(instance.);
}

>>

schema_ensure_mutable(field) ::= <<
if(!((instance. & ) == )) {

    instance. = new java.util.HashMap\<>();

    instance. = new java.util.ArrayList\<>();

    instance. |= ;
}
>>

field_merge_switch(field) ::= <<
case :
    
    
    
    
	
	
	
	
	
	break;
>>

singular_field_merge_switch(field) ::= <<

instance. = input.mergeObject(null, .getSchema());

instance. = input.readEnum();

instance. = input.();

instance. |= ;
>>

oneof_field_merge_switch(field) ::= <<
{
    
    instance. = input.mergeObject(null, .getSchema());
    
    instance. = input.readEnum();
    
    instance. = input.();
    
    instance. = .;
}
>>

map_field_merge_switch(field) ::= <<
{
    
     entry = input.mergeObject(null, .getSchema());
    instance..put(entry.getKey(), entry.getValue());
}
>>

repeated_field_merge_switch(field) ::= <<


instance..add(input.mergeObject(null, .getSchema()));


instance..add(input.readEnum());


instance..add(input.());

>>

field_write_switch(field) ::= <%









%>

singular_field_write_switch(field) ::= <<

if((instance. & ) == ) {
	output.writeObject(, instance., .getSchema(), false);
}

if((instance. & ) == ) {
    // TODO
	output.writeObject(, instance., null, false);
}

if((instance. & ) == ) {
	output.writeEnum(, instance., false);
}

if((instance. & ) == ) {
    output.(, instance., false);
}

>>

oneof_field_write_switch(field) ::= <<

if(instance. == .) {
	output.writeObject(, () instance., .getSchema(), false);
}

if(instance. == .) {
	output.writeEnum(, (int) instance., false);
}

if(instance. == .) {
    output.(, () instance., false);
}

>>

map_field_write_switch(field) ::= <<
for(java.util.Map.Entry\<, \> entry : instance..entrySet()) {
     value = .newBuilder()
        .setKey(entry.getKey())
        .setValue(entry.getValue())
        .build();
    output.writeObject(, value, .getSchema(), true);
}

>>

repeated_field_write_switch(field) ::= <<

for(  : instance.) {
    output.writeObject(, , .getSchema(), true);
}

for(int  : instance.) {
    output.writeEnum(, , true);
}

for(  : instance.) {
    output.(, , true);
}

>>

field_switch_case(field) ::= <<
case : return "";
>>

field_map(field) ::= <<
__fieldMap.put("", );
>>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy