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

com.javaetmoi.javabean.generator.CodeGenerator Maven / Gradle / Ivy

Go to download

The JavaBeanMarshaller class is responsible for serializing an object (graph) to it's Java code.

There is a newer version: 1.0.3
Show newest version
package com.javaetmoi.javabean.generator;


import com.javaetmoi.javabean.JavaBeanMarshaller;
import com.javaetmoi.javabean.bean.Item;
import com.javaetmoi.javabean.bean.SetterParam;
import com.squareup.javapoet.MethodSpec;

/**
 * Interface used to customize the generation of a type.
 * 

* Custom {@link CodeGenerator} has to be registered with the {@link JavaBeanMarshaller#register(CodeGenerator)} register method. *

*/ public interface CodeGenerator { /** * Type supported by this generator. * * @param valueClass type checked * @return true if the generator support the given type */ boolean supports(Class valueClass); /** * Generate a setter statement for a given parameter. *

* This method may also be used to add an object into a collection, a map or an array. *

* @param method Javapoet's method where the statement will be added * @param param */ void generateSetter(MethodSpec.Builder method, SetterParam param); /** * Rework a value wrapped into an item. * * @param marshaller the current instance of the JavaBean marshaller * @param item item to refine */ void refineItem(JavaBeanMarshaller marshaller, Item item); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy