if (type.getResources().get(name) != null) {
throw new DuplicateResourceException(name);
}
String mappedName = annotation.mappedName();
JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
resource.setOptional(annotation.optional());
if (mappedName.length() > 0) {
resource.setMappedName(mappedName);
}
type.getResources().put(resource.getName(), resource);
}