}
public void write(final SourceWriter writer) {
Checker.notNull("parameter:writer", writer);
CodeBlock literal = null;
while (true) {
final Type type = this.getPropertyType();
final GeneratorContext context = this.getGeneratorContext();
if (type == context.getBoolean()) {
literal = new BooleanLiteral(this.getBooleanValue());
break;
}
if (type == context.getByte()) {
literal = new ByteLiteral(this.getByteValue());
break;
}
if (type == context.getShort()) {
literal = new ShortLiteral(this.getShortValue());
break;
}
if (type == context.getInt()) {
literal = new IntLiteral(this.getIntValue());
break;
}
if (type == context.getLong()) {
literal = new LongLiteral(this.getLongValue());
break;
}
if (type == context.getFloat()) {
literal = new FloatLiteral(this.getFloatValue());
break;
}
if (type == context.getDouble()) {
literal = new DoubleLiteral(this.getDoubleValue());
break;
}
if (type == context.getChar()) {
literal = new CharLiteral(this.getCharValue());
break;
}
// will default to String for List/Set/Map which wont have set the
// propertyType of any StringValues
literal = new StringLiteral(this.getValue());
break;
}
literal.write(writer);
}