Goal of this class is to map ProtocolBuffer objects to TikTok Event in generic way
Goal of this class is to map ProtocolBuffer objects to TikTok Event in generic way
- First parameter is ProtocolBuffer class type
- Second parameters is TikTokEvent class type
- Third parameters is bytes payload
mapToEvent(WebcastGiftMessage.class, TikTokGiftEvent.class, payload)
How does it work?
- Finds method
parseFrom(byte[] bytes)inside ProtocolBuffer class - Put payload to the method methods and create new instance of ProtcolBuffer object
- Finds in TikTokEvent constructor that takes ProtocolBuffer type as parameter
- Create new Instance in TikTokEvents using object from step 2 and constructor from step 3
methodCache and constructorCache are used to boost performance
Signature
Section titled “Signature”public class TikTokGenericEventMapperConstructors
Section titled “Constructors”TikTokGenericEventMapper
Section titled “TikTokGenericEventMapper”public TikTokGenericEventMapper()Methods
Section titled “Methods”getParsingMethod
Section titled “getParsingMethod”public Method getParsingMethod(Class<?> input) throws RuntimeExceptionParameters
Section titled “Parameters”input(Class<?>)
Returns
Section titled “Returns”Method
Throws
Section titled “Throws”RuntimeException
mapToEvent
Section titled “mapToEvent”public TikTokEvent mapToEvent(Class<?> inputClazz, Class<?> outputClass, byte[] payload)Parameters
Section titled “Parameters”inputClazz(Class<?>)outputClass(Class<?>)payload(byte[])
Returns
Section titled “Returns”Source
Section titled “Source”Client/src/main/java/io/github/jwdeveloper/tiktok/client/mappers/TikTokGenericEventMapper.java:49