com.sun.tools.xjc.addon.xew.config.ClassConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaxb-xew-plugin Show documentation
Show all versions of jaxb-xew-plugin Show documentation
This JAXB plugin utilizes the power of @XmlElementWrapper annotation. Originally xjc trends to create wrapper classes which are the containers for collections. This plugin goes through all properties to find ones which can be represented in the model in more optimal way.
package com.sun.tools.xjc.addon.xew.config;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* Per-class or per-field configuration.
*/
public class ClassConfiguration extends CommonConfiguration {
public ClassConfiguration(CommonConfiguration configuration) {
super(configuration);
}
/**
* Returns the value of {@code annotate} option. By default returns {@code true}.
*/
public boolean isAnnotatable() {
return ObjectUtils.defaultIfNull((Boolean) configurationValues.get(ConfigurationOption.ANNOTATE), Boolean.TRUE)
.booleanValue();
}
public void setAnnotatable(boolean annotate) {
configurationValues.put(ConfigurationOption.ANNOTATE, Boolean.valueOf(annotate));
}
@Override
protected ToStringBuilder appendProperties(ToStringBuilder builder) {
super.appendProperties(builder);
builder.append("excluded", isAnnotatable());
return builder;
}
}