public boolean isExportable(JAbstractMethod method, JExportableClassType type) {
boolean export = false;
// Only public methods are exported
if (method.isPublic()) {
Export e;
if (method instanceof JConstructor && isInstantiable(method.getEnclosingType()) && method.getParameters().length == 0) {
// zero-arg constructors always exportable
export = true;
} else if (isNotExportable(method.getAnnotation(NoExport.class))) {
// Do not export methods annotated as NoExport, although the
// method is marked as export in an interface or the entire class
// is annotated as Export
export = false;
} else if (isExportable(method.getAnnotation(Export.class))) {
// Export this method if has the Export annotation
export = true;
} else if (isExportable(method.getEnclosingType())) {
// Export all method in a class annotated as Export
export = true;
} else if (type != null && (e = type.getType().getAnnotation(Export.class)) != null && e.all()) {
// Export this method if the class has the Export.all attribute set
// Filter some generic methods present in Object
export = !method.getName().matches("getClass|hashCode|equals|notify|notifyAll|wait");
} else {
// Export methods which are annotated in implemented interfaces