List of usage examples for com.google.gson GsonBuilder disableInnerClassSerialization
public GsonBuilder disableInnerClassSerialization()
From source file:net.sf.uadetector.json.internal.data.serializer.Serializers.java
License:Apache License
private Serializers(final EnumSet<SerDeOption> options) { Check.notNull(options);/*from www . j a v a 2 s. c o m*/ final GsonBuilder gsonBuilder = new GsonBuilder(); // setup serializers gsonBuilder.registerTypeAdapter(Data.class, new DataSerializer()); gsonBuilder.registerTypeAdapter(Browser.class, new BrowserSerializer()); gsonBuilder.registerTypeAdapter(BrowserPattern.class, new OrderedPatternSerializer<BrowserPattern>()); gsonBuilder.registerTypeAdapter(BrowserType.class, new BrowserTypeSerializer()); gsonBuilder.registerTypeAdapter(OperatingSystem.class, new OperatingSystemSerializer()); gsonBuilder.registerTypeAdapter(OperatingSystemPattern.class, new OrderedPatternSerializer<OperatingSystemPattern>()); gsonBuilder.registerTypeAdapter(Robot.class, new RobotSerializer()); gsonBuilder.registerTypeAdapter(Pattern.class, new PatternSerializer()); gsonBuilder.registerTypeAdapter(Device.class, new DeviceSerializer()); gsonBuilder.registerTypeAdapter(DevicePattern.class, new OrderedPatternSerializer<DevicePattern>()); // some settings if (options.contains(SerDeOption.PRETTY_PRINTING)) { gsonBuilder.setPrettyPrinting(); } gsonBuilder.disableInnerClassSerialization(); gson = gsonBuilder.create(); }