org.atemsource.atem.utility.binding.version.VersionedBinder Maven / Gradle / Ivy
package org.atemsource.atem.utility.binding.version;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import org.atemsource.atem.api.attribute.relation.SingleAttribute;
import org.atemsource.atem.api.type.EntityType;
import org.atemsource.atem.impl.json.JsonEntityTypeImpl;
import org.atemsource.atem.impl.meta.DerivedObject;
import org.atemsource.atem.utility.binding.AbstractBinder;
import org.atemsource.atem.utility.binding.AttributeFilter;
import org.atemsource.atem.utility.binding.BindingListener;
import org.atemsource.atem.utility.binding.BindingSession;
import org.atemsource.atem.utility.binding.jackson.JacksonAttributeNameConverter;
import org.atemsource.atem.utility.transform.api.TypeNameConverter;
import org.atemsource.atem.utility.transform.api.meta.Binding;
import org.atemsource.atem.utility.transform.api.meta.DerivedType;
import org.atemsource.atem.utility.transform.impl.BindingMetaAttributeRegistrar;
import org.atemsource.atem.utility.transform.impl.EntityTypeTransformation;
import org.atemsource.atem.utility.transform.impl.version.VersionResolver;
/**
* The version binder creates a target type for each source type and version.
*/
public class VersionedBinder extends AbstractBinder
{
private String prefix;
private VersionResolver versionResolver;
private List versions;
protected TypeNameConverter createTypeCode(final String version)
{
return new VersionTypeNameConverter(prefix, version);
}
public String getPrefix()
{
return prefix;
}
public EntityTypeTransformation getTransformation(Class sourceClass, String version)
{
String targetTypeCode = createTypeCode(version).convert(entityTypeRepository.getEntityType(sourceClass));
EntityType