com.atlassian.bamboo.specs.codegen.emitters.fragment.FieldSetterEmitterFactory Maven / Gradle / Ivy
package com.atlassian.bamboo.specs.codegen.emitters.fragment;
import com.atlassian.bamboo.specs.api.builders.EntityPropertiesBuilder;
import com.atlassian.bamboo.specs.api.codegen.CodeEmitter;
import com.atlassian.bamboo.specs.api.codegen.CodeGenerationContext;
import com.atlassian.bamboo.specs.api.codegen.CodeGenerationException;
import com.atlassian.bamboo.specs.api.codegen.annotations.NoArgCallForBooleanValue;
import com.atlassian.bamboo.specs.api.codegen.annotations.Secret;
import com.atlassian.bamboo.specs.api.codegen.annotations.Setter;
import com.atlassian.bamboo.specs.api.model.EntityProperties;
import com.atlassian.bamboo.specs.codegen.BuilderClassProvider;
import com.atlassian.bamboo.specs.codegen.emitters.CodeGenerationUtils;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
/**
* Utility to resolve the best code generator for a field of {@link EntityProperties} instance.
*/
public final class FieldSetterEmitterFactory {
private FieldSetterEmitterFactory() {
}
private static Object getFirstElement(final Iterable> value) {
return value.iterator().next(); //!called in context when we know element exists;
}
private static CodeEmitter