protected ServiceReferenceMetaData createServiceRef(WebServiceRef annotation, E element) {
    ServiceReferenceMetaData ref = new ServiceReferenceMetaData();
    String name = annotation.name();
    if (name.length() == 0) name = getName(element);
    ref.setServiceRefName(name);
    if (annotation.mappedName().length() > 0) ref.setMappedName(annotation.mappedName());
    ref.setAnnotatedElement(element);
    if (annotation.wsdlLocation().length() > 0) ref.setWsdlFile(annotation.wsdlLocation());
    if (annotation.type() != Object.class) {
      ref.setServiceRefType(annotation.type().getName());
    } else ref.setServiceRefType(getType(element));

    if (annotation.value() != Service.class) {
      ref.setServiceInterface(annotation.value().getName());
    } else if (element instanceof Field) {
      final Class<?> targetClass = ((Field) element).getType();
      if (Service.class.isAssignableFrom(targetClass))
        ref.setServiceInterface(targetClass.getName());
    } else if (element instanceof Method) {
      final Class<?> targetClass = ((Method) element).getParameterTypes()[0];
      if (Service.class.isAssignableFrom(targetClass))
        ref.setServiceInterface(targetClass.getName());
    } else {
      ref.setServiceInterface(Service.class.getName());
    }

    String injectionName = getInjectionName(element);
    Set<ResourceInjectionTargetMetaData> injectionTargets =
        ProcessorUtils.getInjectionTargets(injectionName, element);
    if (injectionTargets != null) ref.setInjectionTargets(injectionTargets);

    return ref;
  }
 public WebServiceRefElement(Member member, PropertyDescriptor pd) {
   super(member, pd);
   AnnotatedElement ae = (AnnotatedElement) member;
   WebServiceRef resource = ae.getAnnotation(WebServiceRef.class);
   String resourceName = resource.name();
   Class<?> resourceType = resource.type();
   this.isDefaultName = !StringUtils.hasLength(resourceName);
   if (this.isDefaultName) {
     resourceName = this.member.getName();
     if (this.member instanceof Method
         && resourceName.startsWith("set")
         && resourceName.length() > 3) {
       resourceName = Introspector.decapitalize(resourceName.substring(3));
     }
   }
   if (resourceType != null && !Object.class.equals(resourceType)) {
     checkResourceType(resourceType);
   } else {
     // No resource type specified... check field/method.
     resourceType = getResourceType();
   }
   this.name = resourceName;
   this.elementType = resourceType;
   if (Service.class.isAssignableFrom(resourceType)) {
     this.lookupType = resourceType;
   } else {
     this.lookupType =
         (!Object.class.equals(resource.value()) ? resource.value() : Service.class);
   }
   this.mappedName = resource.mappedName();
   this.wsdlLocation = resource.wsdlLocation();
 }
  protected void process(ServiceReferencesMetaData refs, E element, WebServiceRef annotation) {
    boolean trace = log.isTraceEnabled();
    String type = annotation.type().getName();
    if (type.equals("java.lang.Object")) type = getType(element);
    if (trace) log.trace("process: " + annotation + ", type=" + type);

    ServiceReferenceMetaData ref = createServiceRef(annotation, element);
    addReference(refs, ref);

    if (trace) log.trace("created service-ref: " + ref);

    /** Delegate @HandlerChain processing to the handlerChainProcessor */
    // handlerChainProcessor.process(ref, element);
  }