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


相关推荐

  • matplotlib数据可视化实例_matplotlib动画

    matplotlib数据可视化实例_matplotlib动画本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理。以下文章来源于Trochil蜂鸟数据,作者蜂鸟数据Trochil一图胜千言,使用Python的matplotlib库,可以快速创建高质量的图形。我们团队推出一个新的系列教程:Python数据可视化,针对初级和中级用户,将理论和示例代码相结合,使用matplotlib,seaborn,plotly等工具实现可视化。本文的主题是如何用Matplotlib创建子图..

    2025年11月14日
    5
  • 人工智能,这五个行业岗位未来很吃香!

    人工智能,这五个行业岗位未来很吃香!

    2021年11月3日
    206
  • DSP28335 Flash烧写

    DSP28335 Flash烧写一.切换为Flash烧写版本方法//1.将主程序中的:MemCopy(&RamfuncsLoadStart,&RamfuncsLoadEnd,&RamfuncsRunStart);//InitFlash();//两个函数取消注释//2.将工程中的28335_RAM_lnk.cmd从工程中删除,添加CMD文件夹下的F283…

    2022年8月30日
    5
  • 精华网页代码

    精华网页代码1.oncontextmenu=”window.event.returnvalue=false”将彻底屏蔽鼠标右键<tableborderoncontextmenu=return(false)><td>no</table>可用于Table2.<bodyonselectstart=”returnfalse…

    2022年5月29日
    45
  • Django(54)drf视图家族[通俗易懂]

    Django(54)drf视图家族[通俗易懂]视图家族drf的视图总共分为以下4个,对应4个源码文件views:视图类generics:工具视图mixins:视图工具集viewsets:视图集学习曲线我们学习视图,可以按照以下的曲线

    2022年7月31日
    4
  • listView1.Items.Add()与 listView1.Items[i].SubItems.Add()区别

    listView1.Items.Add()与 listView1.Items[i].SubItems.Add()区别listView1.Items是ListViewItem的集合打开资源管理器,看看windows目录,使用Details方式,一个ListViewItem就是一行,比如目录名称,修改时间,类型,大小,这整个一条记录是一个ListViewItem而listView1.Items[i].SubItems是ListViewSubItem的集合比如刚才的目录名称或

    2022年7月26日
    5

发表回复

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

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