org.atemsource.atem.utility.binding.jackson.JacksonAttributeNameConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atem-utility Show documentation
Show all versions of atem-utility Show documentation
Atem utilities for cloning, comparing and transforming
The newest version!
package org.atemsource.atem.utility.binding.jackson;
import org.atemsource.atem.api.attribute.Attribute;
import org.atemsource.atem.api.attribute.JavaMetaData;
import org.atemsource.atem.utility.transform.api.AttributeNameConverter;
import org.codehaus.jackson.annotate.JsonProperty;
public class JacksonAttributeNameConverter implements AttributeNameConverter {
@Override
public String convert(Attribute, ?> attribute) {
JsonProperty jsonProperty = ((JavaMetaData) attribute)
.getAnnotation(JsonProperty.class);
if (jsonProperty != null) {
return jsonProperty.value();
} else {
return attribute.getCode();
}
}
}