public class MapAdapter extends PrinterAdapter
Note that this is a partial implementation that shall be extended to support more cases and adapted to your own requirements. Additionally, this implementation generates untyped JavaScript in order to avoid having to have the ES6 API in the compilation path.
| Modifier and Type | Field and Description |
|---|---|
protected static String[] |
mapTypes
Java types that need to be transpiled to ES6 maps.
|
context, logger, typeVariablesToErase| Constructor and Description |
|---|
MapAdapter(PrinterAdapter parent)
Creates the adapter and initialize all type mappings.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
substituteMethodInvocation(MethodInvocationElement invocation)
This where the actual API bridge is implemented.
|
boolean |
substituteNewClass(NewClassElement newClass)
When one of the types in
mapTypes is found, instantiates an ES6
map. |
adaptDocComment, addAnnotation, addAnnotation, addAnnotationManager, addAnnotationWithValue, addHeader, addTypeMapping, addTypeMapping, addTypeMappings, afterType, endIndent, eraseSuperClass, eraseSuperInterface, findExecutableDeclarationInType, getAnnotationValue, getAnnotationValue, getContext, getErasedTypes, getFunctionalTypeMappings, getHeader, getMappedType, getModuleImportDescriptor, getParentAdapter, getParentElement, getParentElement, getPrinter, getRootRelativeName, getTranspilerOptions, getTypeMappingTarget, hasAnnotationType, isAmbientDeclaration, isMappedType, isSubstituteSuperTypes, needsImport, print, print, print, print, printArgList, printIdentifierList, printIndent, println, printMacroName, removeLastChar, removeLastChar, removeLastChars, removeLastIndent, report, report, report, report, setParentAdapter, setPrinter, space, startIndent, substitute, substituteArrayAccess, substituteAssignment, substituteAssignmentWithOperator, substituteBinaryOperator, substituteCaseStatementPattern, substituteForEachLoop, substituteIdentifier, substituteInstanceof, substituteUnaryOperator, substituteVariableAccess, types, utilprotected static String[] mapTypes
public MapAdapter(PrinterAdapter parent)
public boolean substituteNewClass(NewClassElement newClass)
mapTypes is found, instantiates an ES6
map. Delegate to the parent otherwise.substituteNewClass in class PrinterAdapternewClass - the new class expressionpublic boolean substituteMethodInvocation(MethodInvocationElement invocation)
substituteMethodInvocation in class PrinterAdapterinvocation - the invocation being printed