com.javaetmoi.javabean.bean.Item 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.bean;
/**
* Wraps an item value in order to rework it before generating code.
*
* Usage:
*
* - Key or value of a Map
* - Value of an array
* - Custom generator
*
*/
public class Item {
/**
* Wrapped value.
*/
private Object val;
/**
* Class of the value.
*/
private final Class> clazz;
/**
* Javapoet expression.
*/
private String pattern = "$L";
/**
* Item constructor.
*
* @param val value to wrap
*/
public Item(Object val) {
this.val = val;
this.clazz = val.getClass();
}
public void setVal(Object val) {
this.val = val;
}
public Object getVal() {
return val;
}
public Class> getClazz() {
return clazz;
}
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public void appendAfterVal(String str) {
val = val + str;
}
public void appendBeforeVal(String str) {
val = str + val;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy