001/** 002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.jboot.web.json; 017 018import io.jboot.app.config.annotation.ConfigModel; 019 020/** 021 * @author Michael Yang 杨福海 (fuhai999@gmail.com) 022 * @version V1.0 023 */ 024@ConfigModel(prefix = "jboot.json") 025public class JbootJsonConfig { 026 027 //model 和 record 是否自动转为驼峰格式 028 //当配置此项为 false 的时候,需要配置 skipBeanGetters 为 true,否则出现个别相同数据库字段输出两次的情况 029 private boolean camelCaseJsonStyleEnable = true; 030 031 //是否把所有的信息都转为驼峰格式,包括 map 032 private boolean camelCaseToLowerCaseAnyway = false; 033 034 //是否跳过 null 值 035 private boolean skipNullValueField = true; 036 037 //是否跳过 model attrs,而只有使用 getter 来生成 038 private boolean skipModelAttrs = false; 039 040 //是否跳过 getter 方法 041 private boolean skipBeanGetters = false; 042 043 //时间格式化 044 private String timestampPattern; 045 046 //转换深度,防止且套引用导致死循环转换 047 private int depth = 16; 048 049 public boolean isCamelCaseJsonStyleEnable() { 050 return camelCaseJsonStyleEnable; 051 } 052 053 public void setCamelCaseJsonStyleEnable(boolean camelCaseJsonStyleEnable) { 054 this.camelCaseJsonStyleEnable = camelCaseJsonStyleEnable; 055 } 056 057 public boolean isCamelCaseToLowerCaseAnyway() { 058 return camelCaseToLowerCaseAnyway; 059 } 060 061 public void setCamelCaseToLowerCaseAnyway(boolean camelCaseToLowerCaseAnyway) { 062 this.camelCaseToLowerCaseAnyway = camelCaseToLowerCaseAnyway; 063 } 064 065 public boolean isSkipNullValueField() { 066 return skipNullValueField; 067 } 068 069 public void setSkipNullValueField(boolean skipNullValueField) { 070 this.skipNullValueField = skipNullValueField; 071 } 072 073 public boolean isSkipModelAttrs() { 074 return skipModelAttrs; 075 } 076 077 public void setSkipModelAttrs(boolean skipModelAttrs) { 078 this.skipModelAttrs = skipModelAttrs; 079 } 080 081 public boolean isSkipBeanGetters() { 082 return skipBeanGetters; 083 } 084 085 public void setSkipBeanGetters(boolean skipBeanGetters) { 086 this.skipBeanGetters = skipBeanGetters; 087 } 088 089 public String getTimestampPattern() { 090 return timestampPattern; 091 } 092 093 public void setTimestampPattern(String timestampPattern) { 094 this.timestampPattern = timestampPattern; 095 } 096 097 public int getDepth() { 098 return depth; 099 } 100 101 public void setDepth(int depth) { 102 this.depth = depth; 103 } 104}