super(adapters);
}
@Override
public CompilationUnit adapt(CompilationUnitContext context) {
CompilationUnit compilationUnit = createNode(context);
PackageDeclarationContext packageDeclarationContext =
getChild(context, PackageDeclarationContext.class);
if (packageDeclarationContext != null) {
compilationUnit.setPackageDeclaration(
getAdapter(PackageDeclarationAdapter.class).adapt(packageDeclarationContext));
}
List<ImportDeclaration> importDeclarationas =
transform(context, ImportDeclarationContext.class, new Function<ImportDeclarationContext,
ImportDeclaration>() {
@Override
public ImportDeclaration apply(ImportDeclarationContext context) {
return getAdapter(ImportDeclarationAdapter.class).adapt(context);
}
});
compilationUnit.setImportDeclarations(importDeclarationas);
List<TypeDeclaration> typeDeclarations =
transform(context, TypeDeclarationContext.class, new Function<TypeDeclarationContext,
TypeDeclaration>() {
@Override
public TypeDeclaration apply(TypeDeclarationContext context) {
return getAdapter(TypeDeclarationAdapter.class).adapt(context);
}
});
compilationUnit.setTypeDeclarations(typeDeclarations);
return compilationUnit;
}