中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)站開(kāi)發(fā)使用的技術(shù)有哪些網(wǎng)絡(luò)營(yíng)銷推廣方案范文

網(wǎng)站開(kāi)發(fā)使用的技術(shù)有哪些,網(wǎng)絡(luò)營(yíng)銷推廣方案范文,網(wǎng)站模板建站教程視頻,協(xié)會(huì)網(wǎng)站制作前言:經(jīng)常使用Objects.equals(a,b)方法的同學(xué) 應(yīng)該或多或少都會(huì)因?yàn)榇中亩鴤麇e(cuò)參, 例如日常開(kāi)發(fā)中 我們使用Objects.equals去比較 status(入?yún)?,statusEnum(枚舉), 很容易忘記statusEnum.getCode() 或 statusEnum.getVaule() ,再比…

前言:經(jīng)常使用Objects.equals(a,b)方法的同學(xué) 應(yīng)該或多或少都會(huì)因?yàn)榇中亩鴤麇e(cuò)參, 例如日常開(kāi)發(fā)中 我們使用Objects.equals去比較 status(入?yún)?,statusEnum(枚舉), 很容易忘記statusEnum.getCode() 或 statusEnum.getVaule() ,再比如 我們比較一個(gè)訂單code時(shí) orderCode(入?yún)?,orderDTO(其它業(yè)務(wù)對(duì)象) 很容易忘記orderDTO.getCode() 因?yàn)镺bjects.equals()兩個(gè)參數(shù)都是Object類型,idea默認(rèn)不會(huì)提示告警, 如果經(jīng)常使用該方法 你一定很清楚的明白我在說(shuō)什么。

針對(duì)以上痛點(diǎn),博主編寫了一個(gè)idea插件: Equals Inspection , 插件代碼本身很簡(jiǎn)單,極其輕量級(jí)。難得的是 在目前暫沒(méi)發(fā)現(xiàn)有人做了這件事時(shí),而博主想到了可以通過(guò)IDE告警方式去解決問(wèn)題,并且實(shí)際行動(dòng)了。此外,知道該用什么API本身是件不容易的事,而閱讀代碼時(shí),已經(jīng)處于一個(gè)上帝視角,則會(huì)顯得非常簡(jiǎn)單。

Q:為什么是IDE插件層面,而不是在java項(xiàng)目中重寫一個(gè)工具類 針對(duì)類型判斷呢?
A:
1.效率問(wèn)題:java項(xiàng)目代碼判斷 說(shuō)明要執(zhí)行到該方法時(shí)才能校驗(yàn),很多時(shí)候我們編寫完,在測(cè)試環(huán)節(jié)被提了bug,我們自己斷點(diǎn)執(zhí)行一遍,才能發(fā)現(xiàn)傳錯(cuò)了參,插件層面在我們編寫時(shí)即可提醒,節(jié)省了大量時(shí)間.

2.設(shè)計(jì)問(wèn)題: 很重要的一點(diǎn),java項(xiàng)目層面的提示,要怎么提示?throw new RuntimeExection? 顯然不太合理吧,例如在設(shè)計(jì)一些框架/通用代碼時(shí),類型就是可以不一致 難道拋一個(gè)異常阻止程序運(yùn)行嗎?插件盡管會(huì)提示報(bào)錯(cuò),但它歸根結(jié)底都只是一個(gè)樣式,并不會(huì)阻止程序運(yùn)行。

使用前后效果對(duì)比:

使用前沒(méi)有告警
在這里插入圖片描述

使用后示例:

在這里插入圖片描述
vo.getStatus(Integer類型)與枚舉比較時(shí),能直接提示我們類型不一致
(正確寫法是StatusEnum.AWAIT.getValue() 與枚舉類型的值進(jìn)行比較)
在這里插入圖片描述

以下就以博主編寫的插件為例 ,寫一篇如何編寫idea插件的教程

注:本文由csdn博主 孟秋與你 編寫,如您在其它地方看到本文,很可能是被其它博主爬蟲/復(fù)制過(guò)來(lái)的,文章可能會(huì)持續(xù)更新,強(qiáng)烈建議您搜索:孟秋與你csdn 找到原文查看

第一步:創(chuàng)建插件項(xiàng)目
tips:
1.需要jdk11
2.以idea2021.1版本為例,不同idea版本可能有所差異

new project ->IntelliJ Platform Plugin-> Project SDK (需要jdk11)

在這里插入圖片描述

第二步:修改plugin.xml文件內(nèi)容及創(chuàng)建java代碼

其中plugin.xml的description節(jié)點(diǎn),需要40個(gè)字符以上,否則插件上傳時(shí)會(huì)報(bào)錯(cuò)。

編寫插件的核心難點(diǎn)在于,我們不知道idea的api是什么,什么情況用什么api。
以下是可以參考的幾點(diǎn):

  1. idea官方文檔 https://plugins.jetbrains.com/docs/intellij/welcome.html
  2. github idea 示例項(xiàng)目:https://github.com/JetBrains/intellij-sdk-code-samples
<idea-plugin><id>csdn-mengqiuyuni</id><name>Equals參數(shù)類型檢查</name><version>0.1.0</version><vendor email="1005738053@qq.com" url="https://blog.csdn.net/qq_36268103"> </vendor><description><![CDATA[<li>check java.lang.Objects equals method params type ,if not match,idea will show the error line</li><br><li>could reduce Objects.equals(a,b) error params type by mistake</li><br><li>notice:this plugin can only inspect your code,it's just reminder java developers,but don't impact code execution,and never change or fix your code.</li>]]></description><change-notes><![CDATA[<li>github:qiuhuanhen,project name :objects-equals-inspect</li><br><li>beta version.csdn:孟秋與你</li><br><li>the first beta version,welcome,update date:2024.01.09</li>]]></change-notes><vendor>qiuhuanhen</vendor><!-- please see https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html for description --><idea-version since-build="173.0"/><!-- please see https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.htmlon how to target different products --><depends>com.intellij.modules.platform</depends><depends>com.intellij.java</depends><depends>com.intellij.modules.java</depends><extensions defaultExtensionNs="com.intellij"><localInspectionlanguage="JAVA"displayName="Title"groupPath="Java"groupBundle="messages.InspectionsBundle"groupKey="group.names.probable.bugs"enabledByDefault="true"level="ERROR"implementationClass="com.qiuhuanhen.ObjectsEqualsInspection"/><!--java類所在路徑--></extensions></idea-plugin>
package com.qiuhuanhen;import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;/*** @author qiuhuanhen*/
public class ObjectsEqualsInspection extends LocalInspectionTool {@NotNull@Overridepublic PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {return new MyVisitor(holder);}private static class MyVisitor extends JavaElementVisitor {private final ProblemsHolder holder;public MyVisitor(ProblemsHolder holder) {this.holder = holder;}@Overridepublic void visitMethodCallExpression(PsiMethodCallExpression expression) {super.visitMethodCallExpression(expression);String methodName = expression.getMethodExpression().getReferenceName();if ("equals".equals(methodName)) {PsiExpressionList argumentList = expression.getArgumentList();PsiExpression[] expressions = argumentList.getExpressions();if (expressions.length == 2) {PsiType arg1Type = expressions[0].getType();PsiType arg2Type = expressions[1].getType();// 都為空 不做提示  注:即使idea會(huì)提示 type不為空 ,為防止插件報(bào)NPE 還是有大量的非空判斷if (null == arg1Type && null == arg2Type) {return;}// 其一為空 給出錯(cuò)誤提示if (null == arg1Type || null == arg2Type) {holder.registerProblem(expression, "Objects.equals parameters are not of the same type.", ProblemHighlightType.GENERIC_ERROR_OR_WARNING);return;}// 這是忽視某些通用類,框架 用于比較反射class類型的情況if (arg1Type.getCanonicalText().contains("Class") && arg2Type.getCanonicalText().contains("Class")) {return;}if (isByte(arg1Type) && isByte(arg2Type)) {return;}if (isShort(arg1Type) && isShort(arg2Type)) {return;}if (isInt(arg1Type) && isInt(arg2Type)) {return;}if (isLong(arg1Type) && isLong(arg2Type)) {return;}if (isFloat(arg1Type) && isFloat(arg2Type)) {return;}if (isDouble(arg1Type) && isDouble(arg2Type)) {return;}if (isChar(arg1Type) && isChar(arg2Type)) {return;}if (isBoolean(arg1Type) && isBoolean(arg2Type)) {return;}if (!arg1Type.equals(arg2Type)) {holder.registerProblem(expression, "Objects.equals parameters are not of the same type.", ProblemHighlightType.GENERIC_ERROR_OR_WARNING);}}}}private boolean isInt(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.INT.equals(unboxedType)) {// 是 int 類型return true;}return PsiType.INT.equals(type) || "java.lang.Integer".equals(type.getCanonicalText());}private boolean isLong(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.LONG.equals(unboxedType)) {// 是 long 類型return true;}return PsiType.LONG.equals(type) || "java.lang.Long".equals(type.getCanonicalText());}private boolean isDouble(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.DOUBLE.equals(unboxedType)) {return true;}return PsiType.DOUBLE.equals(type) || "java.lang.Double".equals(type.getCanonicalText());}private boolean isFloat(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.FLOAT.equals(unboxedType)) {return true;}return PsiType.FLOAT.equals(type) || "java.lang.Float".equals(type.getCanonicalText());}private boolean isBoolean(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.BOOLEAN.equals(unboxedType)) {return true;}return PsiType.BOOLEAN.equals(type) || "java.lang.Boolean".equals(type.getCanonicalText());}private boolean isByte(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.BYTE.equals(unboxedType)) {return true;}return PsiType.BYTE.equals(type) || "java.lang.Byte".equals(type.getCanonicalText());}private boolean isChar(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.CHAR.equals(unboxedType)) {return true;}return PsiType.CHAR.equals(type) || "java.lang.Char".equals(type.getCanonicalText());}private boolean isShort(PsiType type) {PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);if (PsiType.SHORT.equals(unboxedType)) {return true;}return PsiType.SHORT.equals(type) || "java.lang.Short".equals(type.getCanonicalText());}}
}

第三步:打成jar包
在這里插入圖片描述
沒(méi)有main方法則不用選擇main class
在這里插入圖片描述
在這里插入圖片描述

第四步:發(fā)布插件
在這里插入圖片描述

發(fā)布插件沒(méi)有什么難點(diǎn),唯一值得注意的是description非常嚴(yán)格,必須要40個(gè)字符以上,且不能有非拉丁字符,博主在反復(fù)修改后發(fā)現(xiàn)不能有任何中文,最后把description里面的中文都改成了英文。

插件項(xiàng)目源碼地址:https://github.com/qiuhuanhen/objects-equals-inspect
下載一:( idea團(tuán)隊(duì)給博主發(fā)了郵件 插件最開(kāi)始的命名不規(guī)范 目前在重新審核 不知道后續(xù)結(jié)果 先在github下載吧)
idea插件商店搜索: Equals Inspection

下載二:github https://github.com/qiuhuanhen/objects-equals-inspect

releases區(qū)
在這里插入圖片描述
安裝方式:1. 直接將jar包拖進(jìn)idea,2.重啟idea

打開(kāi)項(xiàng)目方式:
在github下載博主的項(xiàng)目,idea打開(kāi)后 默認(rèn)是常規(guī)項(xiàng)目,這時(shí)我們需要稍作處理
在這里插入圖片描述

在這里插入圖片描述

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
最后一步:
在這里插入圖片描述

最后: 原創(chuàng)不易 ,歡迎各位在idea插件商店下載Equals Inspection , 給github項(xiàng)目點(diǎn)上star 非常感謝各位

http://m.risenshineclean.com/news/32905.html

相關(guān)文章:

  • seo推廣騙局百度快照優(yōu)化公司
  • 數(shù)商云價(jià)格長(zhǎng)治seo顧問(wèn)
  • 網(wǎng)站建設(shè)制作汕頭外貿(mào)網(wǎng)站建設(shè)公司
  • 哪里可以做網(wǎng)站推廣win7優(yōu)化大師好不好
  • 做網(wǎng)站被黑后怎么辦營(yíng)銷方案怎么寫
  • 代理招商平臺(tái)seo網(wǎng)絡(luò)推廣軟件
  • 保安做網(wǎng)站seo排名點(diǎn)擊
  • 張北縣網(wǎng)站建設(shè)外鏈代發(fā)
  • 知名設(shè)計(jì)網(wǎng)站公司百度網(wǎng)盤官網(wǎng)登陸入口
  • wordpress 數(shù)據(jù)庫(kù)編碼杭州seo網(wǎng)站哪家好
  • 網(wǎng)站建設(shè)時(shí)送的ppt方案讓手機(jī)變流暢的軟件下載
  • 桂林網(wǎng)站制作優(yōu)化大師官方
  • 阿里建站系統(tǒng)軟件開(kāi)發(fā)培訓(xùn)機(jī)構(gòu)去哪個(gè)學(xué)校
  • 受歡迎的天津網(wǎng)站建設(shè)百度網(wǎng)盤搜索引擎入口
  • 做長(zhǎng)海報(bào)的網(wǎng)站外包推廣服務(wù)
  • 煙臺(tái)網(wǎng)站建設(shè)搜狗推廣登錄入口
  • 怎么建設(shè)一個(gè)網(wǎng)站賺錢seo排名查詢工具
  • 網(wǎng)站可以微信支付是怎么做的百度熱詞
  • 公司網(wǎng)站的seo優(yōu)化怎么做百度網(wǎng)盤人工客服電話多少
  • 不會(huì)網(wǎng)站維護(hù)可以做嗎怎么開(kāi)通百度推廣賬號(hào)
  • 北京上海網(wǎng)站建設(shè)公司品牌宣傳推廣文案
  • 網(wǎng)站優(yōu)化的策略鎮(zhèn)江網(wǎng)站建設(shè)企業(yè)
  • 北京電腦培訓(xùn)網(wǎng)站軟文廣告示范
  • 上傳網(wǎng)站到二級(jí)域名財(cái)經(jīng)新聞最新消息
  • 昆明網(wǎng)上商城網(wǎng)站建設(shè)市場(chǎng)營(yíng)銷策略
  • 寵物網(wǎng)站開(kāi)發(fā)與實(shí)現(xiàn)軟文推廣做得比較好的推廣平臺(tái)
  • 做集團(tuán)網(wǎng)站應(yīng)注意什么谷歌seo優(yōu)化技巧
  • 做家居商城網(wǎng)站鄭州seo推廣
  • 怎么把網(wǎng)站放到空間嗎教育培訓(xùn)機(jī)構(gòu)平臺(tái)
  • 公眾號(hào)的微網(wǎng)站開(kāi)發(fā)營(yíng)銷型網(wǎng)站建設(shè)排名