java deepcopy_Java JsonNode.deepCopy方法代码示例
import com.fasterxml.jackson.databind.JsonNode; //导入方法依赖的package包/类
/**
* Applies this schema rule to take the required code generation steps.
*
* A Java {@link Enum} is created, with constants for each of the enum
* values present in the schema. The enum name is derived from the nodeName,
* and the enum type itself is created as an inner class of the owning type.
* In the rare case that no owning type exists (the enum is the root of the
* schema), then the enum becomes a public class in its own right.
*
* The actual JSON value for each enum constant is held in a property called
* "value" in the generated type. A static factory method
* fromValue(String)
is added to the generated enum, and the
* methods are annotated to allow Jackson to marshal/unmarshal values
* correctly.
*
* @param nodeName
* the name of the property which is an "enum"
* @param node
* the enum node
* @param container
* the class container (class or package) to which this enum
* should be added
* @return the newly generated Java type that was created to represent the
* given enum
*/
@Override
public JType apply(String nodeName, JsonNode node, JClassContainer container, Schema schema) {
JDefinedClass _enum;
try {
_enum = createEnum(node, nodeName, container);
} catch (ClassAlreadyExistsException e) {
return e.getExistingClass();
}
schema.setJavaTypeIfEmpty(_enum);
if (node.has("javaInterfaces")) {
addInterfaces(_enum, node.get("javaInterfaces"));
}
// copy our node; remove the javaType as it will throw off the TypeRule for our case
ObjectNode typeNode = (ObjectNode)node.deepCopy();
typeNode.remove("javaType");
// If type is specified on the enum, get a type rule for it. Otherwise, we're a string.
// (This is different from the default of Object, which is why we don't do this for every case.)
JType backingType = node.has("type") ?
ruleFactory.getTypeRule().apply(nodeName, typeNode, container, schema) :
container.owner().ref(String.class);
JFieldVar valueField = addValueField(_enum, backingType);
// override toString only if we have a sensible string to return
if(isString(backingType)){
addToString(_enum, valueField);
}
addValueMethod(_enum, valueField);
addEnumConstants(node.path("enum"), _enum, node.path("javaEnumNames"), backingType);
addFactoryMethod(_enum, backingType);
return _enum;
}
java deepcopy_Java JsonNode.deepCopy方法代码示例相关推荐
- java kryo_Kryo框架使用方法代码示例
Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...
- java readtimeout_Java HttpURLConnection.getReadTimeout方法代码示例
import java.net.HttpURLConnection; //导入方法依赖的package包/类 /** * 得到响应对象 * * @param urlConnection * @retu ...
- java invalidate_Java Component.invalidate方法代码示例
import java.awt.Component; //导入方法依赖的package包/类 /** Installs the component we will embed to display t ...
- java hasmoreelements_Java IOException.hasMoreElements方法代码示例
import java.io.IOException; //导入方法依赖的package包/类 /** * fileName���� ���� package �������� ������ ���� ...
- java methode_Java Method.getTypeParameters方法代码示例
import java.lang.reflect.Method; //导入方法依赖的package包/类 private void validateRuleMethod(MethodRuleDefin ...
- java setmethod_Java Operation.setJavaMethod方法代码示例
import com.sun.tools.internal.ws.processor.model.Operation; //导入方法依赖的package包/类 private void createJ ...
- java cancel_Java RunnableFuture.cancel方法代码示例
import java.util.concurrent.RunnableFuture; //导入方法依赖的package包/类 @Test public void testSnapshotAsyncC ...
- java getevent_Java ActionEvent.getWhen方法代码示例
import java.awt.event.ActionEvent; //导入方法依赖的package包/类 @Override final public void actionPerformed(A ...
- java setlayout_Java JLabel.setLayout方法代码示例
import javax.swing.JLabel; //导入方法依赖的package包/类 private void initTitlePanel(){ preYear = new JLabel(& ...
最新文章
- Android Bitmap开发之旅--基本操作
- vue生命周期(列表详解)
- 2018年11月12日
- java去掉图片边框颜色_sharp 去除图片边框
- 233网校计算机二级c语言,[233网校]2018年全国计算机二级Office高级应用精讲班_计算机二级视频教程...
- Windows网络服务---DHCP服务
- hdu--1077--Catching Fish
- Idea安装Eslint插件详解 提示:Plugin NativeScript was not installed解决
- qq for android 4.6能视频吗,安卓qq4.6使用评测
- Jquery(十)jqueryUI常用功能实战
- 学术会议论文查重吗_会议论文查重吗
- 金融衍生品软件产品设计必备知识——上海黄金交易所产品概览
- 聚名企服商标注册流程及资料(2022新版新手教程)
- 【Docker】Linux各系统安装Docker,Docker-compose方式汇总
- 移动端设置overflow-x:hiden后scrollTop失效并一直为0
- c语言编程实现简单三子棋游戏
- 杨永智:创业者需具备的六大基因 五大攻略(下)
- 点到超平面的距离公式推导
- LeetCode4寻找两个有序数组的中位数(二分查找+分治)
- 【JavaScript】获取网页元素