首页 \ 问答 \ SpringBatch - 在FieldSetMapper上获取行号(SpringBatch - Get Line Number on FieldSetMapper)

SpringBatch - 在FieldSetMapper上获取行号(SpringBatch - Get Line Number on FieldSetMapper)

我需要将行号放入FieldSet Mapper中。 我怎样才能做到这一点?

我想使用lineNumber作为Mapper生成的结果对象的字段。

<beans:bean id="fileReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
    <beans:property name="resource" 
        value="file:${batch.source}"/>
    <beans:property name="lineMapper">
        <beans:bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
            <beans:property name="lineTokenizer">
                <beans:bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                    <beans:property name="delimiter" value="${batch.delimiter}"/>
                    <beans:property name="names" value="${batch.columns}"/>
                </beans:bean>
            </beans:property>

            <beans:property name="fieldSetMapper">
                <beans:bean class="my.batch.mapper.ResourceFieldSetMapper"/>
            </beans:property>
        </beans:bean>
    </beans:property>
</beans:bean>

谢谢。


I need to get the line number into the FieldSet Mapper. How can I do this?

I want to use the lineNumber as a field of my resulting object produced by the Mapper.

<beans:bean id="fileReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
    <beans:property name="resource" 
        value="file:${batch.source}"/>
    <beans:property name="lineMapper">
        <beans:bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
            <beans:property name="lineTokenizer">
                <beans:bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                    <beans:property name="delimiter" value="${batch.delimiter}"/>
                    <beans:property name="names" value="${batch.columns}"/>
                </beans:bean>
            </beans:property>

            <beans:property name="fieldSetMapper">
                <beans:bean class="my.batch.mapper.ResourceFieldSetMapper"/>
            </beans:property>
        </beans:bean>
    </beans:property>
</beans:bean>

Thank You.


原文:https://stackoverflow.com/questions/23705400
更新时间:2023-11-19 20:11

最满意答案

我会假设你使用netbeans很抱歉,如果我错了(你没说)。

有两种方法可以做到这一点,第一种方法是为新的JFrame创建一个单独的表单(右键单击> New> JFrame),然后在单击按钮时创建一个新的实例。

第二个选项是在GUI构建器中添加它,如果你这样做它最初不会显示,你必须到左边有一个组件列表,然后点击其他组件> jframe1使它出现(这将隐藏您可以通过单击导航器中的主窗体组件隐藏的主窗体。


I will assume your using netbeans so sorry if I'm wrong about that (you didn't say).

There are two way to do this the first is to create a separate form for your new JFrame (Right-click>New>JFrame) and then create a new instance of it when your button is clicked.

The second option is to add it in GUI builder if you do this it won't show at first, you have to go to the left hand side where there is a list of components and click on Other Components>jframe1 to make it appear (this will hide your main form which you can hide by clicking on the main form component in the navigator.

相关问答

更多
  • 字段(无论是JFrame还是任何其他类型)不是由类拥有,而是由实例拥有。 除非你希望你的Activity子类是单例(意味着它们只有一个实例),否则第一个问题的答案是“否”。 更重要的是,单个应用程序中的多个JFrame肯定不是您想要的。 如果你希望每个子类都有自己的方式来获取输入,那么可能是一个JTextField (嵌入在主框架中),否则一个JDialog (对应一个单独的窗口)就可以了。 Fields (be they JFrames or any other type) are not owned b ...
  • 是的,您总是可以从JFrame获取contentPane并将其放入JInternalFrame的contentPane中(通过预期的get和set方法),但尝试将好的代码添加到糟糕的设计中并不是一个好主意。 您可能最好重构代码并尝试对JPanel而不是JFrame进行编码。 这样你就可以灵活地将你的JPanel放在任何你想要的位置,无论是JInternalFrames,JDialogs,JTabbedPane组件,还是通过CardLayout交换。 Yeah, you could always get th ...
  • 我认为你不能。 当您向其中添加Component时, java.awt.Container中的代码包含此tidbit。 在这里,读取Container JFrame和comp的JPanel : /* Reparent the component and tidy up the tree's state. */ if (comp.parent != null) { comp.parent.remove(comp); if (ind ...
  • 这里: // suspend program until button is pushed // i know, **this is not a very good way of doing it...** (emphasis mine) while(!askPush){} 正如你已经知道的那样,这"is not a very good way of doing it..." 。 这不仅不是一个好方法,而且是一种可怕的方式,它将冻结你的Swing事件线程,而不是事件驱动编程应该如何 ...
  • 尝试这个: Lessons frameLessons = new Lessons(); frameLessons.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frameLessons.setVisible(true); Try this: Lessons frameLessons = new Lessons(); frameLessons.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frameLessons.setVi ...
  • 由于这不是一个真正的编码问题,因此很难为您的问题提供准确的答案。 既然你明确地说我希望能够只运行每个Jframe的一个实例 ,我总会建议使用单例。 它们非常容易编码,并允许您从多个类中访问JFrame。 Since this is not really a coding problem it is difficult to give you a precise answer to your problem. Since you specifically say I want to be able to ru ...
  • 我会假设你使用netbeans很抱歉,如果我错了(你没说)。 有两种方法可以做到这一点,第一种方法是为新的JFrame创建一个单独的表单(右键单击> New> JFrame),然后在单击按钮时创建一个新的实例。 第二个选项是在GUI构建器中添加它,如果你这样做它最初不会显示,你必须到左边有一个组件列表,然后点击其他组件> jframe1使它出现(这将隐藏您可以通过单击导航器中的主窗体组件隐藏的主窗体。 I will assume your using netbeans so sorry if I'm wro ...
  • 为JFrame.Create设置LayoutManager并添加所有组件,然后使Frame可见。 public void createUserInterface(){ JFrame f = new JFrame("Guitar Tuner"); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); ...
  • 您不应该使用多个JFrames有关详细信息,请参阅此链接。 相反,我建议你使用CardLayout,如下所示: import javax.swing.*; import java.awt.*; public class MainFrame { static JPanel homeContainer; static CardLayout cl; JPanel homePanel; JPanel otherPanel; public MainFrame() ...
  • 只需使用模态对话框来代替框架,这样,只有在关闭之前,您才能做其他任何事情 有关说明,请参阅http://mindprod.com/jgloss/modal.html ,有关代码示例,请参阅http://www.java2s.com/Tutorial/Java/0240__Swing/ASimpleModalDialog.htm 。 如果你坚持使用JFrame,你可以通过一个玻璃框来覆盖另一个框架来使用解决方法。我不承认太好的解决方案.. Just use a modal dialog in stead of ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)