public Accessor(MemberDeclaration delegate, TypeDefinition typeDef) { super(delegate); if ((!(delegate instanceof FieldDeclaration)) && (!(delegate instanceof PropertyDeclaration))) { throw new IllegalArgumentException("Only a field or a property can be a JAXB accessor."); } this.typeDefinition = typeDef; this.adapterType = AdapterUtil.findAdapterType(this); }
throw new IllegalStateException("Class not found: " + adaptedType); typeAdapterInfo = getAdaptersOfPackage(pckg).get(typeDeclaration.getQualifiedName());
typeAdapterInfo = getAdaptersOfPackage(pckg).get(((DeclaredType) adaptedType).getDeclaration().getQualifiedName());
protected WebParam(ParameterDeclaration delegate, WebMethod method) { super(delegate); this.method = method; if (this.method == null) { throw new IllegalArgumentException("A web method must be provided."); } annotation = delegate.getAnnotation(javax.jws.WebParam.class); this.adapterType = AdapterUtil.findAdapterType(this); }
public Accessor(MemberDeclaration delegate, TypeDefinition typeDef) { super(delegate); if ((!(delegate instanceof FieldDeclaration)) && (!(delegate instanceof PropertyDeclaration))) { throw new IllegalArgumentException("Only a field or a property can be a JAXB accessor."); } this.typeDefinition = typeDef; this.adapterType = AdapterUtil.findAdapterType(this); this.facets.addAll(Facet.gatherFacets(delegate)); this.facets.addAll(typeDef.getFacets()); }
protected WebParam(ParameterDeclaration delegate, WebMethod method, int parameterIndex) { super(delegate); this.method = method; this.parameterIndex = parameterIndex; if (this.method == null) { throw new IllegalArgumentException("A web method must be provided."); } annotation = delegate.getAnnotation(javax.jws.WebParam.class); this.adapterType = AdapterUtil.findAdapterType(this); EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get(); this.forceSpecCompliance = model != null && model.getEnunciateConfig() != null && model.getEnunciateConfig().isForceJAXWSSpecCompliance(); }
private FaultBeanChildElement(PropertyDeclaration property) { DecoratedTypeMirror propertyType = (DecoratedTypeMirror) property.getPropertyType(); this.adaperType = AdapterUtil.findAdapterType(property.getGetter()); int minOccurs = propertyType.isPrimitive() ? 1 : 0; String maxOccurs = propertyType.isArray() || propertyType.isCollection() ? "unbounded" : "1"; this.property = property; this.minOccurs = minOccurs; this.maxOccurs = maxOccurs; }
/** * Narrows the existing declaration down to its adapting declaration, if it's being adapted. Otherwise, the original declaration will be returned. * * @param declaration The declaration to narrow. * @return The narrowed declaration. */ protected ClassDeclaration narrowToAdaptingType(ClassDeclaration declaration) { AdapterType adapterType = AdapterUtil.findAdapterType(declaration); if (adapterType != null) { TypeMirror adaptingType = adapterType.getAdaptingType(); if (!(adaptingType instanceof ClassType)) { return declaration; } else { ClassDeclaration adaptingDeclaration = ((ClassType) adaptingType).getDeclaration(); if (adaptingDeclaration == null) { throw new ValidationException(declaration.getPosition(), String.format("Class %s is being adapted by a type (%s) that doesn't seem to be on the classpath.", declaration.getQualifiedName(), adaptingType)); } return adaptingDeclaration; } } return declaration; }
return findAdapterType(accessor.getAccessorType(), accessor, accessor.getDeclaringType().getPackage()); return findAdapterType(method.getReturnType(), method, method.getDeclaringType().getPackage()); return findAdapterType(parameter.getType(), parameter, parameter.getWebMethod().getDeclaringEndpointInterface().getPackage()); return findAdapterType(declaredType, null, null);
return findAdapterType(accessor.getAccessorType(), accessor, accessor.getDeclaringType().getPackage()); return findAdapterType(method.getReturnType(), method, method.getDeclaringType().getPackage()); return findAdapterType(parameter.getType(), parameter, parameter.getWebMethod().getDeclaringEndpointInterface().getPackage()); return findAdapterType(declaredType, null, null);
public void visitInterfaceType(InterfaceType interfaceType) { AdapterType adapterType = AdapterUtil.findAdapterType(interfaceType.getDeclaration()); if (adapterType == null) { //the interface isn't adapted, check for @XmlTransient and if it's there, narrow it to java.lang.Object. //see https://jira.codehaus.org/browse/ENUNCIATE-660 if (interfaceType.getDeclaration() != null && interfaceType.getDeclaration().getAnnotation(XmlTransient.class) != null) { AnnotationProcessorEnvironment env = Context.getCurrentEnvironment(); this.result = env.getTypeUtils().getDeclaredType(env.getTypeDeclaration(Object.class.getName())); } } }
public void visitInterfaceType(InterfaceType interfaceType) { AdapterType adapterType = AdapterUtil.findAdapterType(interfaceType.getDeclaration()); if (adapterType != null) { adapterType.getAdaptingType().accept(this); } else { MapType mapType = MapTypeUtil.findMapType(interfaceType); if (mapType != null) { setMapXmlType(mapType); } else { this.xmlType = null; this.errorMessage = "An interface type cannot be an xml type."; } } }
TYPE_STACK.get().push(declaration.getQualifiedName()); try { AdapterType adapterType = AdapterUtil.findAdapterType(declaration); if (adapterType != null) { return findMapType(adapterType.getAdaptingType());
public void visitInterfaceType(InterfaceType interfaceType) { AdapterType adapterType = AdapterUtil.findAdapterType(interfaceType.getDeclaration()); if (adapterType != null) { adapterType.getAdaptingType().accept(this); } else { MapType mapType = MapTypeUtil.findMapType(interfaceType); if (mapType != null) { setMapXmlType(mapType); } else if (isInCollection) { this.xmlType = KnownXmlType.ANY_TYPE; } else { this.xmlType = null; this.errorMessage = "An interface type cannot be an xml type."; } } }
protected WebResult(TypeMirror delegate, WebMethod method) { super(delegate); this.method = method; javax.jws.WebResult annotation = method.getAnnotation(javax.jws.WebResult.class); String name = "return"; if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) { name = annotation.name(); } this.name = name; String targetNamespace = method.getDeclaringEndpointInterface().getTargetNamespace(); if ((annotation != null) && (annotation.targetNamespace() != null) && (!"".equals(annotation.targetNamespace()))) { targetNamespace = annotation.targetNamespace(); } this.targetNamespace = targetNamespace; String partName = "return"; if ((annotation != null) && (!"".equals(annotation.partName()))) { partName = annotation.partName(); } this.partName = partName; this.header = ((annotation != null) && (annotation.header())); this.adapterType = AdapterUtil.findAdapterType(method); }
protected WebResult(TypeMirror delegate, WebMethod method) { super(delegate); 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 = AdapterUtil.findAdapterType(method); 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; }
private FaultBeanChildElement(PropertyDeclaration property, WebFault webFault) { DecoratedTypeMirror propertyType = (DecoratedTypeMirror) property.getPropertyType(); this.adaperType = AdapterUtil.findAdapterType(property.getGetter()); int minOccurs = propertyType.isPrimitive() ? 1 : 0; boolean unbounded = propertyType.isCollection() || propertyType.isArray(); if (propertyType.isArray()) { TypeMirror componentType = ((ArrayType) propertyType).getComponentType(); //special case for byte[] if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) { unbounded = false; } } String maxOccurs = unbounded ? "unbounded" : "1"; this.property = property; this.minOccurs = minOccurs; this.maxOccurs = maxOccurs; this.webFault = webFault; }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { AdapterType adapterType = AdapterUtil.findAdapterType(declaration); if (adapterType != null) { return convert(adapterType.getAdaptingType()); } if (declaration instanceof ClassDeclaration) { DecoratedTypeMirror superType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration) declaration).getSuperclass()); if (superType != null && superType.isInstanceOf(JAXBElement.class.getName())) { //for client conversions, we're going to generalize subclasses of JAXBElement to JAXBElement return convert(superType); } } String convertedPackage = convertPackage(declaration.getPackage()); ClientName specifiedName = isUseClientNameConversions() ? declaration.getAnnotation(ClientName.class) : null; String simpleName = specifiedName == null ? declaration.getSimpleName() : specifiedName.value(); return convertedPackage + getPackageSeparator() + simpleName; } }