{
return ((InterfaceType)intfOrBeanClass).getDeclaration();
}
else if (intfOrBeanClass instanceof ClassType)
{
ClassType classType = (ClassType)intfOrBeanClass;
// If the bean type declaration cannot be found, then the only (valid) possibility
// is that it is a generated type from the current processor pass. See if a base
// interface type can be determined from the current processor input list.
if (classType.getDeclaration() == null)
{
//
// Compute the bean type name, and the associated interface name by stripping
// the "Bean" suffix
//
String className = classType.toString();
AnnotationProcessorEnvironment ape = getAnnotationProcessorEnvironment();
InterfaceDeclaration id = null;
String intfName = null;
if (className.length() > 4) {
intfName = className.substring(0, className.length() - 4);
id = (InterfaceDeclaration)ape.getTypeDeclaration(intfName);
}
if (id == null && intfName != null)
{
// The specified class name may not be fully qualified. In this case, the
// best we can do is look for a best fit match against the input types
for (TypeDeclaration td :ape.getSpecifiedTypeDeclarations())
{
if (td instanceof InterfaceDeclaration &&
td.getSimpleName().equals(intfName))
{
return (InterfaceDeclaration)td;
}
}
}
return id;
}
else
{
// direct supers only
Collection<InterfaceType> intfs = classType.getSuperinterfaces();
// per the code in checkControlField, this set must be of size 1
// and the 1 super interface must be a control interface/extension
// a value of zero may be valid if the control field is not referencing
// a control -- for this case fall through and return null.