首页 \ 问答 \ JAXB XJC抑制ObjectFactory并生成jaxb.index(JAXB XJC Suppress ObjectFactory & Generate jaxb.index)

JAXB XJC抑制ObjectFactory并生成jaxb.index(JAXB XJC Suppress ObjectFactory & Generate jaxb.index)

我的项目中有大量使用xjc ant任务生成的生成类。 默认情况下,生成过程创建一个ObjectFactory.java类。 我想知道是否有一种方法来禁止创建ObjectFactory,而是生成一个jaxb.index文件。

我的理解是,对于序列化和反序列化,jaxb.in​​dex比ObjectFactory更优化。

我正在使用Ant 1.10.3JAXB 2.3.0

谢谢。


I have a large number of Generated Classes in my project that are generated using an xjc ant task. By default, the generation process creates an ObjectFactory.java class. I was wondering if there was a way to suppress the creation of ObjectFactory and instead generate a jaxb.index file.

My understanding is that jaxb.index is more optimal than ObjectFactory for object serialization & deserialization.

I'm working with Ant 1.10.3 & JAXB 2.3.0

Thanks.


原文:https://stackoverflow.com/questions/49908220
更新时间:2023-08-31 17:08

最满意答案

在这种情况下,罪魁祸首竟然是萤火虫

我的测试开发页面通常包含这个(具有讽刺意味)帮助IE中的某些类型的调试:

<!--[if IE]>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<![endif]-->

由于它在文本编辑器中显示为注释,因此很容易被忽略。

警报alert(console.log); 显示firebug lite之前和之后将console.log函数从本机代码更改为

function(){return f.apply(c,arguments)}

...由于某种原因(此刻,在这里)然后什么都不做。

没有Firebug Lite参与, alert(console.log); 在IE中给出了这个:

function log() {
[native code]
}

...如果f12开发工具处于打开状态并且如果不是,则会执行常规日志记录。


The culprit in this case turned out to be, of all things, firebug lite.

My test dev pages often include this to (ironically) aid certain types of debugging in IE:

<!--[if IE]>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<![endif]-->

Since it appears in text editors as a comment, it's easy to accidentally overlook.

Alerting alert(console.log); before and after shows firebug lite changes the console.log function from the native code to this:

function(){return f.apply(c,arguments)}

...which for some reason (at the moment, here) then does nothing.

Without Firebug Lite getting involved, alert(console.log); in IE gives this:

function log() {
[native code]
}

...and does its usual trick of logging if f12 Dev Tools is open and crashing if it isn't.

相关问答

更多
  • 这个日志功能可以在IE上正常调用,这里应用的只是为了显示它的可能性? 是的,是的。 这个具体的例子正是针对相关问题的“真正功能”的一部分。 而且,我从链接的问题假设,如果IE的控制台在运行时关闭,这将失败,所以即使在控制台打开后,日志也不会正常运行,是否正确? 正确。 如我在该问题的答案中所解释的那样, console对象在第一次为特定选项卡打开开发者工具之前不会公开。 大多数开发人员使用控制台垫片,在这种情况下, Function#bind方法变得有点过时,因为您可以使用Function#apply.ap ...
  • 问题是快递路由器在将请求传递给处理程序时不保持对控制台变量(或似乎是进程)的引用。 即使您尝试在同一文件中使用匿名处理程序内的控制台变量(不加载子模块),此问题仍然存在。 解决方案是在app.locals缓存对Scribes控制台的引用,并通过req.app.locals.console访问它。 这个问题的更多细节: app.js中的全局变量可以在路由中访问吗? 我在github上发送了一个pull请求。 我所做的更新标有以下风格的评论: /* * update explination */ The ...
  • 您在加载文档时获得了值。 此时,该值为空。 您需要在click事件中获取值 (function() { var button = document.getElementsByTagName("button"); var userInput = document.getElementById("user_input"); //Get only the element button[0].addEventListener("click", function() { console.l ...
  • delete数组不会更改数组的length 。 它只是将元素值设置为undefined 。 使用splice从数组中删除元素。 delete on array doesn't change the length of array. It just sets the element value to undefined. Use splice to remove element from array.
  • name是window对象中的全局变量。 所以,当你登录时,它会发现全局的,在你的情况下,它的值是空字符串( "" )。 console.log(name); console.log(window.name); name is a global variable which is in the window object. So when you log, it goes and finds the global one, which's value is empty string ("") in you ...
  • 如果您正在调试的javascript尝试向控制台变量写入内容,则会发生这种情况。 作为一个例子,我将以下代码粘贴到一个随机的javascript文件中: console = {}; 的console.log( 'asdfasdf'); 尝试将控制台设置为空对象后,console.log没有执行任何操作。 要解决此问题,您只需要确定脚本尝试更改控制台变量的位置,然后刷新页面。 This can happen if the javascript you are debugging tries to write ...
  • 在这种情况下,罪魁祸首竟然是萤火虫 。 我的测试开发页面通常包含这个(具有讽刺意味)帮助IE中的某些类型的调试: 由于它在文本编辑器中显示为注释,因此很容易被忽略。 警报alert(console.log); 显示firebug lite之前和之后将console.log函数从本机代码 ...
  • 无论使用哪种浏览器(例如Firebug for Firefox),脚本的console.log()输出都会转到开发人员工具的控制台窗口。 浏览器开发工具从浏览器所在的位置获取脚本文件; 即,但是你有他们加载到您的网页。 Right, the console.log() output from your scripts goes to the console window of the developer tools of whatever browser you're using (e.g. Firebug ...
  • 您必须将代码放在 You have to put your code inside