Class TypePoolCreator<T>
- java.lang.Object
-
- com.google.javascript.rhino.serialization.TypePoolCreator<T>
-
public class TypePoolCreator<T> extends java.lang.ObjectClass that aids in building a pool of serialized typesThis class's purpose is to build the pool of all types and construct pointers into that pool.
To add a new type to the pool or get a pointer to a type already in the pool, call
typeToPointer(Object, Supplier). Once all types have been registered callgenerateTypePool().
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDisambiguationEdge(com.google.javascript.jscomp.serialization.TypePointer subtype, com.google.javascript.jscomp.serialization.TypePointer supertype)Adds an edge from the given subtype to the given supertype if both are user-defined types and not native.static <T> TypePoolCreator<T>create(SerializationOptions serializationOptions)Creates a new TypePoolCreatorcom.google.javascript.jscomp.serialization.TypePoolgenerateTypePool()Generates a "type-pool" representing all the types that this class has encountered through calls totypeToPointer(Object, Supplier).com.google.javascript.jscomp.serialization.TypePointertypeToPointer(T t, java.util.function.Supplier<com.google.javascript.jscomp.serialization.Type> serialize)Returns the type-pointer for the given AST-type, adding it to the type-pool if not present.
-
-
-
Method Detail
-
create
public static <T> TypePoolCreator<T> create(SerializationOptions serializationOptions)
Creates a new TypePoolCreator
-
generateTypePool
public com.google.javascript.jscomp.serialization.TypePool generateTypePool()
Generates a "type-pool" representing all the types that this class has encountered through calls totypeToPointer(Object, Supplier). After generation, no new types can be added, so subsequent calls totypeToPointer(Object, Supplier)can only be used to retrieve pointers to existing types in the type pool.
-
typeToPointer
public com.google.javascript.jscomp.serialization.TypePointer typeToPointer(T t, java.util.function.Supplier<com.google.javascript.jscomp.serialization.Type> serialize)
Returns the type-pointer for the given AST-type, adding it to the type-pool if not present.The type-pointer is a reference that can be later used to look up the given type in the type-pool. This function memoizes type-pointers and can be safely called multiple times for a given type.
The given serializer will be called only once per type during type pool generation.
-
addDisambiguationEdge
public void addDisambiguationEdge(com.google.javascript.jscomp.serialization.TypePointer subtype, com.google.javascript.jscomp.serialization.TypePointer supertype)Adds an edge from the given subtype to the given supertype if both are user-defined types and not native.
-
-