零拷贝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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Unity3D之如何将包大小减少到极致

    Unity3D之如何将包大小减少到极致

    2021年5月11日
  • 数仓分层

    000概述数仓分层是数据仓库设计中十分重要的一个环节,优秀的分层设计能够让整个数据体系更容易理解和使用本文的大纲001,介绍数据分层的作用002,分层设计的原则以及介绍一种通用的数据分层设计003,具体案例004,落地实践意见005,思考001,数据分层的作用我们需要一套行之有效的数据组织和管理方法来让我们的数据体系更有序,这就是数据分层。数据分层的好处有①,清晰数据结构:每一…

    2022年4月4日
  • pytest fixtures_jig和fixture的区别

    pytest fixtures_jig和fixture的区别fixture的优势Pytest的fixture相对于传统的xUnit的setup/teardown函数做了显著的改进:命名方式灵活,不局限于setup和teardown这几个命名conf

    2022年7月31日
  • 网盘资料

    网盘资料

    2021年10月9日
  • 鸿蒙3部曲先看哪部,“隋唐三部曲”“鸿蒙三部曲”“斗罗四部曲”谁才是网文巅峰之作…

    鸿蒙3部曲先看哪部,“隋唐三部曲”“鸿蒙三部曲”“斗罗四部曲”谁才是网文巅峰之作…原标题:“隋唐三部曲”“鸿蒙三部曲”“斗罗四部曲”谁才是网文巅峰之作从网络小说诞生的那一刻起,续集就是一个绕不过去的话题,如同电视剧一样。一部网络小说红了之后,它的原作者很多时候会忍不住开发它的续集,形成一个系列,然后再现网文界。小编今天就给大家介绍一下网文界最为著名的三个系列:“隋唐三部曲”“鸿蒙三部曲”“斗罗四部曲”,它们都曾红极一时,写下了赫赫威名,是网文界绕不过去系列作品,也是把作品开发到…

    2022年6月29日
  • POI导出excel执行公式 公式不生效问题[通俗易懂]

    POI导出excel执行公式 公式不生效问题[通俗易懂]excel模板设置好公式即可。在下面这行代码:workbook.write(out);// 输出Excel内容,生成Excel文件 之前,添加这个语句:workbook.setForceFormulaRecalculation(true);// 执行公式。workbook.setForceFormulaRecalculation(true);// 执行公式workbook.write(out);// 输出Excel内容,生成Excel文件…

    2022年8月19日

发表回复

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

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