当前位置: 首页 > news >正文

南宁建网站网站备案需要去哪里

南宁建网站,网站备案需要去哪里,wordpress页面分栏,网站开发小程序代码生成是减少无聊任务的不健康负担的一种常用方法#xff0c;这些任务常常使我们急切的代码苦恼。 我见过的许多代码生成框架都使用模板替换重复方法#xff0c;在该方法中#xff0c;您可以编写一个模板#xff0c;以了解生成的代码文件的外观#xff0c;然后替换某些关… 代码生成是减少无聊任务的不健康负担的一种常用方法这些任务常常使我们急切的代码苦恼。 我见过的许多代码生成框架都使用模板替换重复方法在该方法中您可以编写一个模板以了解生成的代码文件的外观然后替换某些关键字并重复其他部分以生成所需的特定文件。 这种让我烦恼的方法的问题是要编译生成的代码真的很难知道生成的代码是否可以正常工作。 您可能已经更改了一个类的名称并且突然生成的代码无法构建。 为了解决这个问题 我启动了一个名为CodeGen的项目 该项目旨在完全面向对象以便从模板到可执行代码的所有类型安全中受益。 生成器的主要用例是Speedment软件 但它可以用于各种项目。 考虑以下代码 final Generator generator new JavaGenerator();final File file File.of(org/example/Foo.java).add(Class.of(Foo).public_().add(Field.of(x, DOUBLE_PRIMITIVE).final_()).add(Field.of(y, DOUBLE_PRIMITIVE).final_()).add(Field.of(z, DOUBLE_PRIMITIVE).final_()).call(new AutoConstructor()).call(new AutoSetGetAdd()).call(new AutoEquals())).call(new AutoJavadoc()).call(new AutoImports(generator)) ; 应用程序的模型树是使用bean构建的。 可以将新方法和成员变量添加到树中以创建同一类的变体。 当要呈现代码时可以轻松地将其传递给生成器类。 String code generator.on(file).get(); 生成的代码如下所示 /*** Write some documentation here.*/ package org.example;import java.util.Optional;/*** author You name here*/ public class Foo {private final double x;private final double y;private final double z;/*** Initializes the Foo component.** param x the x* param y the y* param z the z*/public Foo(double x, double y, double z) {this.x x;this.y y;this.z z;}/*** Returns the value of x.** return the value of x*/public double getX() {return x;}/*** Sets a new value for x.** param x the new value of x*/public void setX(double x) {this.x x;}/*** Returns the value of y.** return the value of y*/public double getY() {return y;}/*** Sets a new value for y.** param y the new value of y*/public void setY(double y) {this.y y;}/*** Returns the value of z.** return the value of z*/public double getZ() {return z;}/*** Sets a new value for z.** param z the new value of z*/public void setZ(double z) {this.z z;}/*** Generates a hashCode for this object. If any field is* changed to another value, the hashCode may be different.* Two objects with the same values are guaranteed to have* the same hashCode. Two objects with the same hashCode are* not guaranteed to have the same hashCode.** return the hash code*/Overridepublic int hashCode() {int hash 7;hash 31 * hash (Double.hashCode(this.x));hash 31 * hash (Double.hashCode(this.y));hash 31 * hash (Double.hashCode(this.z));return hash;}/*** Compares this object with the specified one for equality.* The other object must be of the same type and not null for* the method to return true.** param other the object to compare with* return {code true} if the objects are equal*/Overridepublic boolean equals(Object other) {return Optional.ofNullable(other).filter(o - getClass().equals(o.getClass())).map(o - (Foo) o).filter(o - this.x o.x).filter(o - this.y o.y).filter(o - this.z o.z).isPresent();} } 每个组件都实现为一个接口类对因此您可以动态更改实现而无需重写系统的其他部分。 希望这对其他人有帮助 翻译自: https://www.javacodegeeks.com/2016/02/object-oriented-approach-code-generation.html
http://www.zqtcl.cn/news/183659/

相关文章:

  • 潍坊哪里有做360网站的成都官微最新发布
  • 还有哪些网站可以做淘宝活动企业建设网站的方式
  • 上海技术公司做网站2022引流人脉推广软件
  • 网站排名优化技术安徽省城乡和建设厅网站
  • 平阴县建设工程网站英文网站模板制作
  • 网站制作超链接怎么做厦门公司建站
  • 阿里云做的网站怎么备份建筑设计网站issuu
  • 网上做设计网站广西做网站找谁
  • 网站优化成本建设项目网站备案申请表
  • 做公众号首图网站上海短期网站建设培训
  • 网站开发最好佛山优化网站排名
  • 服务器搭建网站打不开网站建设信息平台
  • 宽屏蓝色企业网站源码如何编辑网站标题
  • 免费搭建手机网站广告公司怎么取名
  • 网站抓取超时错误c 高性能网站开发
  • 营销导向企业网站策划wordpress 不显示菜单
  • 特效视频网站用.net做视频网站的案例
  • 网站建设实用的网站视屏网站的审核是怎么做的
  • 网站模板之家免费下载福州网红餐厅
  • 西安网站设计与建设第三方检测机构
  • 手机网站推广法建设网站明细报价表
  • 一级a做爰片免费网站录像好商网的网站可以做中英文切换吗
  • 视频网站闪图怎么做网件路由器管理地址
  • 一个完整的网站建设网站模板去哪要
  • 烤漆 东莞网站建设水果香精东莞网站建设技术支持
  • 国家重大项目建设库网站北京网站开发外包公司
  • 建设免费网站制作二维码的软件app
  • 网站突然没收录了网站建设和运营的成本是多少钱
  • 家政公司网站模板wordpress防cc代码
  • 福田附近做网站公司网站反向链接