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


相关推荐

  • android错误之android.os.NetworkOnMainThreadException

    在做一个天气预报的widget的时候,参考了一个源代码,但是一直报错,就从里面抠出来获取天气的代码试试看,结果总是报错 就是这个异常,android.os.NetworkOnMainThreadException代码是这样的:MainActivity:public class MainActivity extends Activity { MyWeather myWe

    2022年3月10日
    37
  • 请问怎么获取对方IP地址

    请问怎么获取对方IP地址

    2021年7月30日
    44
  • 理解self,this,parent

    理解self,this,parent

    2021年6月30日
    85
  • ECharts介绍及使用方法

    ECharts介绍及使用方法前面做项目时用到ECharts,今天特此整理一下,作为笔记,同时希望帮助更多人。首先简单介绍一下,ECharts是一个纯JavaScript图表库,底层依赖于轻量级的Canvas类库ZRender,基于BSD开原协议,是一款非常优秀的可视化前端框架。官网地址:http://echarts.baidu.com/1.首先在官网选择合适的下载版本http://echart…

    2022年6月12日
    41
  • tcptraceroute与traceroute

    tcptraceroute与traceroute1traceroute功能说明:显示数据包到主机间的路径。它默认发送的数据包大小是40字节。通过traceroute我们可以知道信息从你的计算机到互联网另一端的主机是走的什么路径。当然每次数据包由某一同样的出发点(source)到达某一同样的目的地(destination)走的路径可能会不一样,但基本上来说大部分时候所走的路由是相同的。工作原理Traceroute程序的…

    2022年6月20日
    27
  • 游戏服务器架构演化史pdf_分布式游戏服务器

    游戏服务器架构演化史pdf_分布式游戏服务器类型1:卡牌、跑酷等弱交互服务端卡牌跑酷类因为交互弱,玩家和玩家之间不需要实时面对面PK,打一下对方的离线数据,计算下排行榜,买卖下道具即可,所以实现往往使用简单的HTTP服务器:登录时可以使用非对称加密(RSA,DH),服务器根据客户端uid,当前时间戳还有服务端私钥,计算哈希得到的加密key并发送给客户端。之后双方都用HTTP通信,并用那个key进行RC4加密。客户端收到key和时间

    2022年10月21日
    3

发表回复

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

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