String with = decorateData.getWith();
GenerateMethodAnnotationData gbad = classLevelGenerators.get(with);
if (gbad != null) {
DescriptorImpl generatedDescriptor = new DescriptorImpl();
generatedDescriptor.setImplementation(gbad.getImplementation());
for (String contract : gbad.getContracts()) {
generatedDescriptor.addAdvertisedContract(contract);
}
if (gbad.getName() != null) {
generatedDescriptor.setName(gbad.getName());
}
generatedDescriptor.addMetadata(METHOD_ACTUAL, implName);
generatedDescriptor.addMetadata(METHOD_NAME, decorateData.getMethodName());
generatedDescriptor.addMetadata(PARENT_CONFIGURED, decorateData.getTargetType());
if (verbose) {
System.out.println("Generated Descriptor for class-level GenerateServiceFromMethod annotation: " +
generatedDescriptor);
};
generatedDescriptors.add(generatedDescriptor);
return;
}
}
if (verbose) {
System.out.println("Class " + implName + " is not annotated with @Service");
}
return;
}
DescriptorImpl generatedDescriptor = new DescriptorImpl();
generatedDescriptor.setImplementation(implName);
if (scopeClass == null) {
// The default for classes with Service is Singleton
generatedDescriptor.setScope(Singleton.class.getName());
}
else {
generatedDescriptor.setScope(scopeClass);
}
if (providedContracts != null) {
for (String providedContract : providedContracts) {
generatedDescriptor.addAdvertisedContract(providedContract);
}
}
else {
generatedDescriptor.addAdvertisedContract(implName);
for (String iFace : iFaces) {
generatedDescriptor.addAdvertisedContract(iFace);
}
}
for (String qualifier : qualifiers) {
generatedDescriptor.addQualifier(qualifier);
}
if (baseName != null) {
generatedDescriptor.setName(baseName.getName());
}
generatedDescriptor.setClassAnalysisName(classAnalyzer);
if (metadataString != null) {
Map<String, List<String>> serviceMetadata = new HashMap<String, List<String>>();
ReflectionHelper.parseServiceMetadataString(metadataString, serviceMetadata);
generatedDescriptor.addMetadata(serviceMetadata);
}
if (rank != null) {
generatedDescriptor.setRanking(rank.intValue());
}
if (useProxy != null) {
generatedDescriptor.setProxiable(useProxy);
}
generatedDescriptor.setDescriptorVisibility(visibility);
if (!metadata.isEmpty()) {
for (Map.Entry<String, List<String>> entry : metadata.entrySet()) {
String key = entry.getKey();
List<String> values = entry.getValue();
for (String value : values) {
generatedDescriptor.addMetadata(key, value);
}
}
}
if (verbose) {