public WebFault(ClassDeclaration delegate) {
super(delegate);
this.annotation = getAnnotation(javax.xml.ws.WebFault.class);
ClassType explicitFaultBeanType = null;
Collection<PropertyDeclaration> properties = getProperties();
PropertyDeclaration faultInfoProperty = null;
for (PropertyDeclaration propertyDeclaration : properties) {
if ("faultInfo".equals(propertyDeclaration.getPropertyName())) {
faultInfoProperty = propertyDeclaration;
break;
}
}
if ((faultInfoProperty != null) && (faultInfoProperty.getPropertyType() instanceof ClassType)) {
ClassType faultInfoType = (ClassType) faultInfoProperty.getPropertyType();
if (faultInfoType.getDeclaration() == null) {
throw new ValidationException(getPosition(), getQualifiedName() + ": class not found: " + faultInfoType + ".");
}
boolean messageConstructorFound = false;
boolean messageAndThrowableConstructorFound = false;
Collection<ConstructorDeclaration> constructors = getConstructors();
for (ConstructorDeclaration constructor : constructors) {
if (constructor.getModifiers().contains(Modifier.PUBLIC)) {
ParameterDeclaration[] parameters = constructor.getParameters().toArray(new ParameterDeclaration[constructor.getParameters().size()]);
if (parameters.length >= 2) {
DecoratedTypeMirror param0Type = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(parameters[0].getType());
DecoratedTypeMirror param1Type = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(parameters[1].getType());
if (parameters.length == 2) {
messageConstructorFound |= param0Type.isInstanceOf(String.class.getName()) && param1Type.isInstanceOf(faultInfoType.getDeclaration().getQualifiedName());
}
else if (parameters.length == 3) {
DecoratedTypeMirror param2Type = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(parameters[2].getType());
messageAndThrowableConstructorFound |= param0Type.isInstanceOf(String.class.getName())
&& param1Type.isInstanceOf(faultInfoType.getDeclaration().getQualifiedName())
&& param2Type.isInstanceOf(Throwable.class.getName());
}
}
}
}