零拷贝java_java arraycopy方法

零拷贝java_java arraycopy方法importcom.fasterxml.jackson.databind.JsonNode;//导入方法依赖的package包/类/***Appliesthisschemaruletotaketherequiredcodegenerationsteps.**AJava{@linkEnum}iscreated,withconstantsforeach…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

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;

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/186803.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 区块链工程师需要掌握哪些技能?

    作者:Annchain(本文一切著作权归annchain技术团队所有,未经许可,不得转载。若需转载请联系页尾二维码。) 从2017年开始,区块链逐步成为互联网的风口浪尖。曝光度的激增带来了人才市场的火爆。 区块链所要求的知识并非什么特殊的或者新兴的知识,除了密码学领域的知识需要专门了解之外,其他知识和技能几乎都是一些比较通用的网络开发核心知识。 由于区块链行业涉及到的范…

    2022年4月5日
    55
  • VCLibs库文件包下载_怎么使用已有的加速包

    VCLibs库文件包下载_怎么使用已有的加速包本文以MDI应用程序为例说明如何在已有的VC++工程中使用BCG界面库,我的开发环境为VS2003。1、将BCG/BCGCBPro目录路径添加到“项目属性->C/C++->常规->附加包含目录”中,同时将BCG/Bin目录路径添加到“项目属性->链接器->常规->附加库目录”中。2、确保在CWinApp派生类(设为CMyApp)的InitInstance()成员函数中调用AfxOl

    2022年10月8日
    2
  • Clion2022.01激活码_在线激活

    (Clion2022.01激活码)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html40ZKSWCX8G-eyJsaWNlbnNlSWQi…

    2022年4月2日
    113
  • 整理计算机病毒的知识点,计算机病毒知识点整理「建议收藏」

    整理计算机病毒的知识点,计算机病毒知识点整理「建议收藏」《计算机病毒分析与防范技术》知识点整理本知识点涵盖期末考试的内容,请自行完善,以便用于开卷考试。7.※清除宏病毒的方法清除宏病毒方法一、验证是否感染了宏病毒?打开需要检查的文档,单击“文件”菜单栏,选择“另存为”命令,如果对话框中的保存类型固定为“文档模板”,则表示这个文件已经感染了宏病毒。二、清除宏病毒的方法1、OFFICE2003方法:打开文档,工具――宏――宏(或者使用组合键“Alt…

    2022年5月7日
    31
  • 国内云计算厂商众生相:四大阵营十几家企业生存盘点

    国内云计算厂商众生相:四大阵营十几家企业生存盘点

    2021年7月1日
    130
  • jquery nextsibling_javascript中预编译

    jquery nextsibling_javascript中预编译JavaScript中的nextSibling和previousSibling和作用类似于jquery的next()和prev(),都是获取下一个/上一个同胞元素,如果下一个同级节点不存在,则此属性返

    2022年8月2日
    10

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号