com.cedarsoft.serialization.generator.output.serializer
Interface SerializeToGenerator


public interface SerializeToGenerator

Interface that is able to create statements that are directly related to the serializeTo and deserializeFrom methods of a serializer


Method Summary
 boolean canHandle(com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)
          Whether this generator is able to handle the given field
 com.sun.codemodel.JStatement createAddToSerializeToExpression(AbstractGenerator<?> generator, com.sun.codemodel.JDefinedClass serializerClass, com.sun.codemodel.JExpression serializeTo, com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo, com.sun.codemodel.JVar object, com.sun.codemodel.JVar formatVersion)
          Creates a statement that is used to store the object (converted as string) to the serializeTo object
 com.cedarsoft.codegen.Expressions createReadFromDeserializeFromExpression(AbstractGenerator<?> generator, com.sun.codemodel.JDefinedClass serializerClass, com.sun.codemodel.JExpression deserializeFrom, com.sun.codemodel.JVar wrapper, com.sun.codemodel.JVar formatVersion, com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)
          Creates an expression that is used to read an object (as String) from deserializeFrom
 com.sun.codemodel.JClass generateFieldType(com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)
           
 

Method Detail

createAddToSerializeToExpression

@Nonnull
com.sun.codemodel.JStatement createAddToSerializeToExpression(@Nonnull
                                                                      AbstractGenerator<?> generator,
                                                                      @Nonnull
                                                                      com.sun.codemodel.JDefinedClass serializerClass,
                                                                      @Nonnull
                                                                      com.sun.codemodel.JExpression serializeTo,
                                                                      @Nonnull
                                                                      com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo,
                                                                      @Nonnull
                                                                      com.sun.codemodel.JVar object,
                                                                      @Nonnull
                                                                      com.sun.codemodel.JVar formatVersion)
Creates a statement that is used to store the object (converted as string) to the serializeTo object

Parameters:
generator - the generator
serializerClass - the serializer class
serializeTo - the serialize to var
fieldInfo - the field info @return the invocation the serializes the given
object - the object that is serialized @return the created statement
formatVersion - the format version
Returns:
the created statement

createReadFromDeserializeFromExpression

@Nonnull
com.cedarsoft.codegen.Expressions createReadFromDeserializeFromExpression(@Nonnull
                                                                                  AbstractGenerator<?> generator,
                                                                                  @Nonnull
                                                                                  com.sun.codemodel.JDefinedClass serializerClass,
                                                                                  @Nonnull
                                                                                  com.sun.codemodel.JExpression deserializeFrom,
                                                                                  com.sun.codemodel.JVar wrapper,
                                                                                  @Nonnull
                                                                                  com.sun.codemodel.JVar formatVersion,
                                                                                  @Nonnull
                                                                                  com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)
Creates an expression that is used to read an object (as String) from deserializeFrom

Parameters:
generator - the generator
serializerClass - the serializer class
deserializeFrom - the object that shall be used to deserialize from
wrapper - the (optional) wrapper
formatVersion - the format version
fieldInfo - the field info @return the expression that returns the object as string @return the created statement @return the created expression
Returns:
the created expressions

generateFieldType

@Nonnull
com.sun.codemodel.JClass generateFieldType(@Nonnull
                                                   com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)

canHandle

boolean canHandle(@Nonnull
                  com.cedarsoft.codegen.model.FieldDeclarationInfo fieldInfo)
Whether this generator is able to handle the given field

Parameters:
fieldInfo - the field info
Returns:
true if this generator is able to handle that field, false otherwise


Copyright © 2011 cedarsoft GmbH. All Rights Reserved.