com.ebay.jsoncoder.BeanCoderContext Maven / Gradle / Ivy
The newest version!
/*************************************************************
Copyright 2018-2019 eBay Inc.
Author/Developer: Jianwu Chen
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
************************************************************/
package com.ebay.jsoncoder;
import com.ebay.jsoncoder.treedoc.TDNode;
import com.ebay.jsoncodercore.factory.InjectableFactory;
import com.ebay.jsoncodercore.factory.InjectableFactory.CachePolicy;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
/**
* Context object for BeanCoder, it will save session information during encoding and provide a
* way to let client to customize the encode behavior.
*/
@RequiredArgsConstructor
public class BeanCoderContext {
// For performance reason, we need to cache SimpleDateFormat in the same thread as SimpleDateFormat is not threadsafe
public static final InjectableFactory dateFormatCache =
InjectableFactory.of(String.class, SimpleDateFormat.class, CachePolicy.THREAD_LOCAL);
@Getter final JSONCoderOption option;
/**
* Used only for encoding, remember encoded objects to be used to dedupWithreference
* Key is the Object to be encoded or EqualsWrapper or the object, the value of this map is the converted result
*/
@Getter final Map