/** * A web fault has an explicit fault bean if all three of the following are present: * <p/> * <ol> * <li>A getFaultInfo method that returns the bean instance of a class type. * <li>A constructor taking a message and bean instance. * <li>A constructor taking a message, a bean instance, and a cause. * </ol> * * @return The explicit fault bean of this web fault, if exists, or null otherwise. */ public ElementDeclaration findExplicitFaultBean() { if (this.explicitFaultBeanType == null || this.explicitFaultBeanType.asElement() == null) { return null; } return this.context.getJaxbContext().findElementDeclaration(this.explicitFaultBeanType.asElement()); }
/** * Gets the xml type of this result. * * @return The xml type of this result. */ public XmlType getXmlType() { XmlType xmlType = XmlTypeFactory.findSpecifiedType(this, this.context.getJaxbContext()); if (xmlType == null) { xmlType = XmlTypeFactory.getXmlType(getType(), this.context.getJaxbContext()); } return xmlType; }
@Override public Set<Syntax> getSyntaxes(ApiRegistrationContext context) { return this.context.getEndpointInterfaces().isEmpty() ? Collections.<Syntax>emptySet() : Collections.<Syntax>singleton(new SyntaxImpl(this.context.getJaxbContext(), context)); }
@Override public TypeMirror getType() { TypeMirror type = super.asType(); MapType mapType = MapType.findMapType(type, this.context.getJaxbContext()); if (mapType != null) { type = mapType; } return type; }
/** * If this is an implicit fault bean, return the child elements. * * @return The child elements of the bean, or null if none. */ public Collection<ImplicitChildElement> getChildElements() { if (!isImplicitSchemaElement()) { return Collections.emptyList(); } Set<ImplicitChildElement> childElements = new TreeSet<ImplicitChildElement>(new Comparator<ImplicitChildElement>() { public int compare(ImplicitChildElement o1, ImplicitChildElement o2) { return o1.getElementName().compareTo(o2.getElementName()); } }); for (PropertyElement property : getAllFaultProperties(this)) { String propertyName = property.getPropertyName(); if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName)) || "suppressed".equals(propertyName)) { continue; } childElements.add(new FaultBeanChildElement(property, this, context.getJaxbContext())); } return childElements; }
/** * Gets the xml type for this web parameter. * * @return The xml type. */ public XmlType getXmlType() { XmlType xmlType = XmlTypeFactory.findSpecifiedType(this, this.context.getJaxbContext()); if (xmlType == null) { TypeMirror type = getType(); if (isHolder()) { List<? extends TypeMirror> typeArgs = ((DeclaredType) type).getTypeArguments(); if ((typeArgs == null) || (typeArgs.size() == 0)) { throw new EnunciateException("Parameter " + getSimpleName() + ": unable to get the type of the holder."); } type = typeArgs.iterator().next(); } xmlType = XmlTypeFactory.getXmlType(type, this.context.getJaxbContext()); } return xmlType; }
@Override public DecoratedTypeMirror getReturnType() { TypeMirror type = super.getReturnType(); MapType mapType = MapType.findMapType(type, this.context.getJaxbContext()); if (mapType != null) { type = mapType; } return (DecoratedTypeMirror) TypeMirrorDecorator.decorate(type, this.env); }
@Override public String getSlug() { return "service_" + this.ei.getContext().getJaxbContext().getNamespacePrefixes().get(this.ei.getTargetNamespace()) + "_" + this.ei.getServiceName(); }
protected WebParam(VariableElement delegate, WebMethod method, int parameterIndex, EnunciateJaxwsContext context) { super(delegate, context.getContext().getProcessingEnvironment()); this.context = context; this.method = method; this.parameterIndex = parameterIndex; if (this.method == null) { throw new IllegalArgumentException("A web method must be provided."); } this.annotation = delegate.getAnnotation(javax.jws.WebParam.class); this.adapterType = JAXWSUtil.findAdapterType(this, context.getJaxbContext()); this.useSourceParameterNames = context.isUseSourceParameterNames(); }
protected WebResult(TypeMirror delegate, WebMethod method, EnunciateJaxwsContext context) { super(delegate, context.getContext().getProcessingEnvironment()); this.context = context; this.method = method; this.annotation = method.getAnnotation(javax.jws.WebResult.class); String partName = "return"; if ((this.annotation != null) && (!"".equals(this.annotation.partName()))) { partName = this.annotation.partName(); } this.partName = partName; this.header = ((this.annotation != null) && (this.annotation.header())); this.adapterType = JAXBUtil.findAdapterType(method, context.getJaxbContext()); String name = "return"; if ((this.annotation != null) && (this.annotation.name() != null) && (!"".equals(this.annotation.name()))) { name = this.annotation.name(); this.elementName = name; } else if (!isHeader() && isImplicitSchemaElement()) { this.elementName = method.getSimpleName() + "Response"; } else if (this.header) { this.elementName = ""; } else { this.elementName = name; } this.name = name; }