}
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());
}
}
}
}
if (messageConstructorFound && messageAndThrowableConstructorFound) {
explicitFaultBeanType = faultInfoType;
}
}
if (faultInfoProperty != null && explicitFaultBeanType == null) {
throw new ValidationException(faultInfoProperty.getPosition(), "The 'getFaultInfo' method is only allowed on a web fault if you're " +
"declaring an explicit fault bean, and you don't have the right constructor signatures set up in order for '" +
faultInfoProperty.getPropertyType() + "' to be an explicit fault bean.");
}
this.explicitFaultBeanType = explicitFaultBeanType;