Package com.esotericsoftware.kryo.util
Class NoGenerics
- java.lang.Object
-
- com.esotericsoftware.kryo.util.NoGenerics
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.esotericsoftware.kryo.util.Generics
Generics.GenericsHierarchy, Generics.GenericType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Generics.GenericsHierarchybuildHierarchy(Class type)Builds aGenerics.GenericsHierarchyfor the specified type.intgetGenericTypesSize()Returns the number of generic types currently trackedClassnextGenericClass()Resolves the first type parameter and returns the class, or null if it could not be resolved or there are no type parameters.Generics.GenericType[]nextGenericTypes()Returns the current type parameters andpushesthe next level of type parameters for subsequent calls.voidpopGenericType()Removes the generic types being tracked since the correspondingGenerics.pushGenericType(GenericType).voidpopTypeVariables(int count)Removes the number of entries that were pushed byGenerics.pushTypeVariables(GenericsHierarchy, GenericType[]).voidpushGenericType(Generics.GenericType fieldType)Sets the type that is currently being serialized.intpushTypeVariables(Generics.GenericsHierarchy hierarchy, Generics.GenericType[] args)Stores the types of the type parameters for the specified class hierarchy.ClassresolveTypeVariable(TypeVariable typeVariable)Returns the class for the specified type variable, or null if it is not known.
-
-
-
Field Detail
-
INSTANCE
public static final Generics INSTANCE
-
-
Method Detail
-
buildHierarchy
public Generics.GenericsHierarchy buildHierarchy(Class type)
Description copied from interface:GenericsBuilds aGenerics.GenericsHierarchyfor the specified type.- Specified by:
buildHierarchyin interfaceGenerics
-
pushGenericType
public void pushGenericType(Generics.GenericType fieldType)
Description copied from interface:GenericsSets the type that is currently being serialized. Must be balanced byGenerics.popGenericType(). Between those calls, thetype parametersare returned byGenerics.nextGenericTypes()andGenerics.nextGenericClass().- Specified by:
pushGenericTypein interfaceGenerics
-
popGenericType
public void popGenericType()
Description copied from interface:GenericsRemoves the generic types being tracked since the correspondingGenerics.pushGenericType(GenericType). This is safe to call even ifGenerics.pushGenericType(GenericType)was not called.- Specified by:
popGenericTypein interfaceGenerics
-
nextGenericTypes
public Generics.GenericType[] nextGenericTypes()
Description copied from interface:GenericsReturns the current type parameters andpushesthe next level of type parameters for subsequent calls. Must be balanced byGenerics.popGenericType()(optional if null is returned). If multiple type parameters are returned, the last is used to advance to the next level of type parameters.Generics.nextGenericClass()is easier to use when a class has a single type parameter. When a class has multiple type parameters,Generics.pushGenericType(GenericType)must be used for all except the last parameter.- Specified by:
nextGenericTypesin interfaceGenerics- Returns:
- May be null.
-
nextGenericClass
public Class nextGenericClass()
Description copied from interface:GenericsResolves the first type parameter and returns the class, or null if it could not be resolved or there are no type parameters. UsesGenerics.nextGenericTypes(), so must be balanced byGenerics.popGenericType()(optional if null is returned).This method is intended for ease of use when a class has a single type parameter.
- Specified by:
nextGenericClassin interfaceGenerics- Returns:
- May be null.
-
pushTypeVariables
public int pushTypeVariables(Generics.GenericsHierarchy hierarchy, Generics.GenericType[] args)
Description copied from interface:GenericsStores the types of the type parameters for the specified class hierarchy. Must be balanced byGenerics.popTypeVariables(int)if >0 is returned.- Specified by:
pushTypeVariablesin interfaceGenericsargs- May contain null for type arguments that aren't known.- Returns:
- The number of entries that were pushed.
-
popTypeVariables
public void popTypeVariables(int count)
Description copied from interface:GenericsRemoves the number of entries that were pushed byGenerics.pushTypeVariables(GenericsHierarchy, GenericType[]).- Specified by:
popTypeVariablesin interfaceGenerics- Parameters:
count- Must be even.
-
resolveTypeVariable
public Class resolveTypeVariable(TypeVariable typeVariable)
Description copied from interface:GenericsReturns the class for the specified type variable, or null if it is not known.- Specified by:
resolveTypeVariablein interfaceGenerics- Returns:
- May be null.
-
getGenericTypesSize
public int getGenericTypesSize()
Description copied from interface:GenericsReturns the number of generic types currently tracked- Specified by:
getGenericTypesSizein interfaceGenerics
-
-