public <T> Codec<T> create(AnnotatedElement metadata, Class<T> type,
ResolverContext context) {
if (metadata != null
&& metadata.isAnnotationPresent(BoundExplicitly.class)) {
BoundExplicitly settings = metadata
.getAnnotation(BoundExplicitly.class);
try {
CodecFactory factory = settings.factory().newInstance();
return factory.create(metadata, type, null);
} catch (InstantiationException e) {
throw new CodecConstructionException(
"Failed to construct Codec using "
+ settings.factory().getName());
} catch (IllegalAccessException e) {
throw new CodecConstructionException(
"No permission to construct an instance of "
+ settings.factory().getName());
}
} else {
return null;
}
}