use of com.webcohesion.enunciate.metadata.ClientName in project enunciate by stoicflame.
the class ClientClassnameForMethod method convert.
@Override
public String convert(TypeElement declaration) throws TemplateModelException {
String fqn = declaration.getQualifiedName().toString();
if (classConversions.containsKey(fqn)) {
return classConversions.get(fqn);
} else if (declaration.getKind() == ElementKind.ENUM) {
return "String";
} else if (isCollection(declaration) || isStream(declaration)) {
return "Array";
} else if (isMap(declaration)) {
return "Hash";
}
if (this.jacksonContext != null) {
AdapterType adapterType = JacksonUtil.findAdapterType(declaration, this.jacksonContext);
if (adapterType != null) {
return convert(adapterType.getAdaptingType());
}
}
if (this.jackson1Context != null) {
com.webcohesion.enunciate.modules.jackson1.model.adapters.AdapterType adapter1Type = com.webcohesion.enunciate.modules.jackson1.model.util.JacksonUtil.findAdapterType(declaration, this.jackson1Context);
if (adapter1Type != null) {
return convert(adapter1Type.getAdaptingType());
}
}
String convertedPackage = convertPackage(this.context.getProcessingEnvironment().getElementUtils().getPackageOf(declaration));
ClientName specifiedName = declaration.getAnnotation(ClientName.class);
String simpleName = specifiedName == null ? declaration.getSimpleName().toString() : specifiedName.value();
return convertedPackage + getPackageSeparator() + simpleName;
}
Aggregations