Class typeOfTeResult = null;
if (AsanaData.class.isAssignableFrom(expectedResult)) {
typeOfTeResult = expectedResult;
} else {
AsanaDataType asanaDataType = expectedResult.getAnnotation(AsanaDataType.class);
if (asanaDataType != null) {
typeOfTeResult = asanaDataType.value();
}
}
if (typeOfTeResult == null) {
throw new IllegalArgumentException(String.format("Can not get expected type of result <%s>, you need to use implementation of <%s> and provide annotation <%s> on data object",
expectedResult.getName(), AsanaData.class.getName(), AsanaDataType.class.getName()));