導航:首頁 > 編程語言 > java去掉注釋

java去掉注釋

發布時間:2024-08-27 00:25:24

⑴ 通過cxf的wsdl2java生成的java代碼裡面的註解能去掉嗎

您好,我來為您解答:
「基於 XML 的 Web Service 的 Java API」(JAX-WS)通過使用注釋來指定與 Web Service 實現相關聯的元數據以及簡化 Web Service 的開發。注釋描述如何將伺服器端的服務實現作為 Web Service 來訪問或者客戶端的 Java 類如何訪問 Web Service。
JAX-WS 編程標准支持將具有用於定義服務端點應用程序的元數據的 Java 類作為 Web Service 來注釋以及注釋客戶機可以如何訪問 Web Service。JAX-WS 支持使用基於 Metadata Facility for the Java Programming Language(Java 規范請求(JSR)175)規范和「用於 Java 平台的 Web Service 元數據」(JSR 181)規范的注釋,還可以使用由 JAX-WS 2.0(JSR 224)規范定義的注釋(包括 JAXB 注釋)。通過使用符合 JSR 181 標準的注釋,可以簡單地注釋服務實現類或服務介面,並且現在將應用程序作為 Web Service 來啟用。通過在 Java 源代碼中使用注釋可以簡化 Web Service 的開發和部署,因為會定義一些通常從部署描述符文件和 WSDL 文件中獲得的附加信息,或者會將元數據從 XML 和 WSDL 映射至源工件中。
使用注釋來配置綁定、處理程序鏈、埠類型的集合名稱、服務以及其他 WSDL 參數。注釋用於將 Java 映射至 WSDL 和模式,以及在運行時控制 JAX-WS 運行時處理和響應 Web Service 調用的方式。轉載,僅供參考。
如果我的回答沒能幫助您,請繼續追問。

⑵ java 如何去掉注釋中的:@autho

你是用的Eclipse嗎?
是的話.你打開eclipse,然後打開Preferences - java - CodeStyle - Code Templates - Comments - Types 然後點擊右邊的Edit進行編輯,刪除當中的@author

⑶ java讀取txt文件,如何過濾掉注釋

處理的重點就是如何判斷和刪除兩行注釋中間的不是以"#"或者"~"開頭的注釋行,草草寫了段代碼,對於樓主給的那段some.txt能夠正常處理
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class DelectComments {
public static void main(String rags[]) {
File f = new File("D:\\Hello.txt");
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
boolean flag1 = false;// #
boolean flag2 = false;// ~
String content = "";
// last output content
ArrayList<String> outputContents = new ArrayList<String>();
// the number of lines that between 2 comments lines start with "#" or "~"
int commentsLineNum = 0;
while ((content = br.readLine()) != null) {
// the line is comments and start with "#"
if (content.startsWith("#")) {
// delete the comments lines between 2 comments lines start with "#"
if (flag1) {
for (int i = 0; i < commentsLineNum; i++) {
outputContents.remove(outputContents.size() - 1);
}
commentsLineNum = 0;
} else {
flag1 = true;
}
// the line is comments and start with "~"
} else if (content.startsWith("~")) {
// delete the comments lines between 2 comments lines start with "~"
if (flag2) {
for (int i = 0; i < commentsLineNum; i++) {
outputContents.remove(outputContents.size() - 1);
}
commentsLineNum = 0;
} else {
flag2 = true;
}
} else {
outputContents.add(content);
commentsLineNum++;
}
}
// output the text
for (String outputContent : outputContents) {
System.out.println(outputContent);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
但是還有個問題就是該程序沒有考慮到如果在正文以後再次出現注釋行的情況,如果用本程序處理的話,就會錯誤的把正文也作為注釋刪除,如果有高人的話還望能夠不吝賜教。

⑷ java 如何去掉xml注釋串

你好,你可以使用xmlFileContent.replaceAll("(?s)<!--.*?-->","");
這樣就可以去掉所有的注釋了

閱讀全文

與java去掉注釋相關的資料

熱點內容
redis有序集合演算法 瀏覽:778
java獲取最大值 瀏覽:74
linux硬體配置命令 瀏覽:948
java6webservice 瀏覽:450
硬體加密的未來發展趨勢 瀏覽:589
釘釘上文件夾怎麼做 瀏覽:277
編譯動物之塔 瀏覽:613
玩嘻哈必下的app在哪裡下 瀏覽:210
談談如何給文件夾或文件加密 瀏覽:37
螺桿式壓縮機溫度計 瀏覽:706
gnu編譯器pdf 瀏覽:463
稀有程序員圖片 瀏覽:43
linux系統有哪些版本的 瀏覽:149
黑月編譯器優缺點 瀏覽:685
線刷包為啥要解壓 瀏覽:149
伺服器滑道怎麼安裝 瀏覽:700
手游發貨伺服器是什麼 瀏覽:711
文件夾的各個名稱 瀏覽:724
安卓系統哪個文件夾存放密碼文件 瀏覽:363
傳真伺服器什麼意思 瀏覽:251