com.javaetmoi.javabean.generator.DefaultCodeGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaetmoi-javabean-marshaller Show documentation
Show all versions of javaetmoi-javabean-marshaller Show documentation
The JavaBeanMarshaller class is responsible for serializing an object (graph) to it's Java code.
package com.javaetmoi.javabean.generator;
import com.javaetmoi.javabean.JavaBeanMarshaller;
import com.javaetmoi.javabean.bean.Item;
import com.javaetmoi.javabean.bean.SetterParam;
import java.lang.reflect.ParameterizedType;
public abstract class DefaultCodeGenerator implements CodeGenerator {
@Override
public boolean supports(Class> valueClass) {
return ((Class) ((ParameterizedType) getClass()
.getGenericSuperclass()).getActualTypeArguments()[0]).isAssignableFrom(valueClass);
}
@Override
public void refineItem(JavaBeanMarshaller marshaller, Item item) {
// nothing for most type
}
protected T getValue(SetterParam param) {
return (T) param.getValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy