1 package com.thoughtworks.xstream.mapper; 2 3 import com.thoughtworks.xstream.alias.ClassMapper; 4 5 import java.util.Collections ; 6 import java.util.HashSet ; 7 import java.util.Set ; 8 9 15 public class ImmutableTypesMapper extends MapperWrapper { 16 17 private final Set immutableTypes = Collections.synchronizedSet(new HashSet ()); 18 19 public ImmutableTypesMapper(ClassMapper wrapped) { 20 super(wrapped); 21 } 22 23 public void addImmutableType(Class type) { 24 immutableTypes.add(type); 25 } 26 27 public boolean isImmutableValueType(Class type) { 28 if (immutableTypes.contains(type)) { 29 return true; 30 } else { 31 return super.isImmutableValueType(type); 32 } 33 } 34 35 } 36 | Popular Tags |