PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/com/alibaba/fastjson/serializer/AtomicReferenceSerializer.java

https://bitbucket.org/xiejuntao/xdesktop
Java | 35 lines | 12 code | 5 blank | 18 comment | 0 complexity | 6c28f7e5f66e486e3b612b833b98c7d5 MD5 | raw file
  1. /*
  2. * Copyright 1999-2101 Alibaba Group.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.alibaba.fastjson.serializer;
  17. import java.io.IOException;
  18. import java.lang.reflect.Type;
  19. import java.util.concurrent.atomic.AtomicReference;
  20. /**
  21. * @author wenshao<szujobs@hotmail.com>
  22. */
  23. public class AtomicReferenceSerializer implements ObjectSerializer {
  24. public final static AtomicReferenceSerializer instance = new AtomicReferenceSerializer();
  25. @SuppressWarnings("rawtypes")
  26. public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
  27. AtomicReference val = (AtomicReference) object;
  28. serializer.write(val.get());
  29. }
  30. }