logger.log(TreeLogger.TRACE, "Found Annotation instance", null);
return toReturn;
}
// Otherwise, fall back to HasMetaData
MetaDataName metaDataName = annotation.getAnnotation(MetaDataName.class);
if (metaDataName == null) {
// Indicates that the requested annotation doesn't have legacy support
logger.log(TreeLogger.TRACE, "No legacy support for this annotation",
null);
return null;
}
String tagName = metaDataName.value();
boolean hasTag = false;
for (String tag : target.getMetaDataTags()) {
if (tagName.equals(tag)) {
hasTag = true;
if (!SUPPRESS_WARNINGS) {
logger.log(TreeLogger.WARN, target
+ " uses deprecated metadata. Replace with annotation "
+ annotation.getName(), null);
}
break;
}
}
if (!hasTag) {
logger.log(TreeLogger.TRACE, "No metadata with tag " + tagName, null);
return null;
}
Object value;
try {
Method valueMethod = annotation.getMethod("value");
Class<?> returnType = valueMethod.getReturnType();
String[][] metaData = target.getMetaData(metaDataName.value());
// Use the default value if there's no value in the metadata
Object annotationDefaultValue;
try {
annotationDefaultValue = annotation.getMethod("value").getDefaultValue();