From 72153fd56a5bdae32c8318278412005936d15752 Mon Sep 17 00:00:00 2001
From: fabiorj
Date: Sat, 4 Dec 2021 12:20:46 -0300
Subject: [PATCH] commit inicial
---
jrimum-texgit/.gitignore | 8 +
jrimum-texgit/CHANGELOG.md | 13 +
jrimum-texgit/LICENSE | 191 +++++++
jrimum-texgit/README.md | 9 +
jrimum-texgit/pom.xml | 205 +++++++
.../main/assembly/jrimum-texgit-examples.xml | 27 +
.../jrimum-texgit-with-dependencies.xml | 24 +
.../main/java/org/jrimum/texgit/FlatFile.java | 66 +++
.../org/jrimum/texgit/ReadWriteStream.java | 69 +++
.../main/java/org/jrimum/texgit/Record.java | 46 ++
.../main/java/org/jrimum/texgit/Texgit.java | 126 ++++
.../org/jrimum/texgit/TexgitException.java | 76 +++
.../org/jrimum/texgit/TextListStream.java | 39 ++
.../java/org/jrimum/texgit/TextStream.java | 48 ++
.../texgit/engine/FixedFieldBuilder.java | 263 +++++++++
.../jrimum/texgit/engine/FlatFileBuilder.java | 82 +++
.../jrimum/texgit/engine/RecordBuilder.java | 137 +++++
.../jrimum/texgit/engine/RecordFactory.java | 100 ++++
.../engine/TexgitLanguageException.java | 73 +++
.../jrimum/texgit/engine/TexgitManager.java | 60 ++
.../texgit/engine/TexgitSchemaValidator.java | 68 +++
.../jrimum/texgit/engine/TexgitXmlReader.java | 94 +++
.../jrimum/texgit/language/EnumFormats.java | 86 +++
.../texgit/language/EnumFormatsTypes.java | 81 +++
.../jrimum/texgit/language/EnumPaddings.java | 82 +++
.../org/jrimum/texgit/language/EnumSide.java | 80 +++
.../org/jrimum/texgit/language/EnumTypes.java | 87 +++
.../org/jrimum/texgit/language/MetaField.java | 309 ++++++++++
.../jrimum/texgit/language/MetaFiller.java | 113 ++++
.../jrimum/texgit/language/MetaFlatFile.java | 106 ++++
.../jrimum/texgit/language/MetaFormatter.java | 106 ++++
.../texgit/language/MetaGroupFields.java | 172 ++++++
.../texgit/language/MetaGroupRecords.java | 95 ++++
.../jrimum/texgit/language/MetaLayout.java | 127 +++++
.../texgit/language/MetaOrderedField.java | 78 +++
.../jrimum/texgit/language/MetaRecord.java | 183 ++++++
.../jrimum/texgit/language/MetaTexgit.java | 116 ++++
.../jrimum/texgit/language/ObjectFactory.java | 178 ++++++
.../jrimum/texgit/language/package-info.java | 40 ++
.../texgit/type/AbstractStringOfFields.java | 332 +++++++++++
.../java/org/jrimum/texgit/type/Field.java | 59 ++
.../java/org/jrimum/texgit/type/Filler.java | 162 ++++++
.../java/org/jrimum/texgit/type/Fixed.java | 52 ++
.../org/jrimum/texgit/type/FixedField.java | 48 ++
.../org/jrimum/texgit/type/FixedLength.java | 42 ++
.../org/jrimum/texgit/type/FixedSize.java | 38 ++
.../texgit/type/component/BlockOfFields.java | 228 ++++++++
.../jrimum/texgit/type/component/Field.java | 406 +++++++++++++
.../jrimum/texgit/type/component/Filler.java | 264 +++++++++
.../jrimum/texgit/type/component/Fillers.java | 167 ++++++
.../texgit/type/component/FixedField.java | 233 ++++++++
.../texgit/type/component/FlatFile.java | 321 +++++++++++
.../jrimum/texgit/type/component/Record.java | 446 +++++++++++++++
.../texgit/type/component/RecordFactory.java | 41 ++
.../jrimum/texgit/type/component/Side.java | 13 +
.../src/main/resources/TexgitSchema.xsd | 537 ++++++++++++++++++
.../texgit/type/component/TestFiller.java | 257 +++++++++
.../texgit/type/component/TestFixedField.java | 228 ++++++++
.../org/jrimum/utilix/excludes/TestUtil.java | 80 +++
59 files changed, 7817 insertions(+)
create mode 100644 jrimum-texgit/.gitignore
create mode 100644 jrimum-texgit/CHANGELOG.md
create mode 100644 jrimum-texgit/LICENSE
create mode 100644 jrimum-texgit/README.md
create mode 100644 jrimum-texgit/pom.xml
create mode 100644 jrimum-texgit/src/main/assembly/jrimum-texgit-examples.xml
create mode 100644 jrimum-texgit/src/main/assembly/jrimum-texgit-with-dependencies.xml
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/FlatFile.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/ReadWriteStream.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/Record.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/Texgit.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/TexgitException.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/TextListStream.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/TextStream.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FixedFieldBuilder.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FlatFileBuilder.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordBuilder.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordFactory.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitLanguageException.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitManager.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitSchemaValidator.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitXmlReader.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormats.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormatsTypes.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumPaddings.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumSide.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumTypes.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaField.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFiller.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFlatFile.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFormatter.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupFields.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupRecords.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaLayout.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaOrderedField.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaRecord.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaTexgit.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/ObjectFactory.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/language/package-info.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/AbstractStringOfFields.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/Field.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/Filler.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/Fixed.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedField.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedLength.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedSize.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/BlockOfFields.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Field.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Filler.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Fillers.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FixedField.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FlatFile.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Record.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/RecordFactory.java
create mode 100644 jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Side.java
create mode 100644 jrimum-texgit/src/main/resources/TexgitSchema.xsd
create mode 100644 jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFiller.java
create mode 100644 jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFixedField.java
create mode 100644 jrimum-texgit/src/test/java/org/jrimum/utilix/excludes/TestUtil.java
diff --git a/jrimum-texgit/.gitignore b/jrimum-texgit/.gitignore
new file mode 100644
index 0000000..9873cc9
--- /dev/null
+++ b/jrimum-texgit/.gitignore
@@ -0,0 +1,8 @@
+/bin
+/target
+.classpath
+.DS_Store
+.project
+.settings
+
+
diff --git a/jrimum-texgit/CHANGELOG.md b/jrimum-texgit/CHANGELOG.md
new file mode 100644
index 0000000..d8d89f5
--- /dev/null
+++ b/jrimum-texgit/CHANGELOG.md
@@ -0,0 +1,13 @@
+Texgit Changelog
+=============================
+
+0.2.3 (2014/02/01) suport bopepo-0.2.3
+---------------------------------------
+
+**Improvement**
+
+ * #1: Implementação de testes para funcionalidade LineOfFields
+
+
+0.2.0-SNAPSHOT (2010/12/07) incubation
+---------------------------------------
\ No newline at end of file
diff --git a/jrimum-texgit/LICENSE b/jrimum-texgit/LICENSE
new file mode 100644
index 0000000..37ec93a
--- /dev/null
+++ b/jrimum-texgit/LICENSE
@@ -0,0 +1,191 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included on
+the same "printed page" as the copyright notice for easier identification within
+third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/jrimum-texgit/README.md b/jrimum-texgit/README.md
new file mode 100644
index 0000000..fd183fc
--- /dev/null
+++ b/jrimum-texgit/README.md
@@ -0,0 +1,9 @@
+Texgit
+======
+
+[](https://ci-jrimum.rhcloud.com)
+
+O projeto Texgit é um componente e framework em Java que facilita a manipulação de arquivos Flat Files (arquivo-texto) através de objetos.
+
+Diversas empresas já usam o Texgit em produção e estão colaborando no Design do componente e da API.
+
diff --git a/jrimum-texgit/pom.xml b/jrimum-texgit/pom.xml
new file mode 100644
index 0000000..5838662
--- /dev/null
+++ b/jrimum-texgit/pom.xml
@@ -0,0 +1,205 @@
+
+
+ 4.0.0
+ br.com.rjconsultores
+ jrimum-texgit
+ Projeto Texgit
+ 1.0.0
+ Projeto open source de componentes de software para o domínio de negócios do Brasil.
+ http://www.jrimum.org/texgit
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ Projeto JRimum
+ http://www.jrimum.org
+
+
+
+ GitHub
+ http://github.com/jrimum/texgit/issues
+
+
+
+ http://github.com/jrimum/texgit
+
+
+
+
+ Gilmar P. S. L.
+ gilmatryx@gmail.com
+
+
+ Misael Barreto
+ misaelbarreto@gmail.com
+
+
+ Rômulo Augusto
+ romulomail@gmail.com
+
+
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+
+ disable-java8-doclint
+
+ [1.8,)
+
+
+ -Xdoclint:none
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+ 1.5
+ 1.5
+
+
+
+ org.codehaus.mojo
+ animal-sniffer-maven-plugin
+ 1.6
+
+
+ org.codehaus.mojo.signature
+ java15
+ 1.0
+
+
+
+
+ animal-sniffer
+ compile
+
+ check
+
+
+
+
+
+ maven-assembly-plugin
+ 2.4
+
+
+ src/main/assembly/jrimum-texgit-with-dependencies.xml
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.16
+
+ false
+
+ org/jrimum/texgit/**/*
+
+
+ org/jrimum/texgit/excludes/**/*
+ org/jrimum/texgit/**/*$*
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+ package
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+ attach-javadoc
+ package
+
+ jar
+
+
+
+
+ UTF-8
+ UTF-8
+ true
+ private
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.1
+
+
+
+
+
+
+ br.com.rjconsultores
+ jrimum-utilix
+ 1.0.0
+
+
+ sun-jaxb-rj
+ jaxb-api
+ 2.2
+
+
+ sun-jaxb-rj
+ jaxb-impl
+ 2.2
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+ rj-releases
+ http://52.5.53.15:8081/nexus/content/repositories/releases/
+
+
+
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/assembly/jrimum-texgit-examples.xml b/jrimum-texgit/src/main/assembly/jrimum-texgit-examples.xml
new file mode 100644
index 0000000..07651a4
--- /dev/null
+++ b/jrimum-texgit/src/main/assembly/jrimum-texgit-examples.xml
@@ -0,0 +1,27 @@
+
+ examples
+
+ zip
+
+
+
+ src/examples/java
+ true
+ /
+
+ **/*.java
+
+
+
+ src/examples/resources
+ true
+ /resources
+
+ **/**
+
+
+
+
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/assembly/jrimum-texgit-with-dependencies.xml b/jrimum-texgit/src/main/assembly/jrimum-texgit-with-dependencies.xml
new file mode 100644
index 0000000..5929366
--- /dev/null
+++ b/jrimum-texgit/src/main/assembly/jrimum-texgit-with-dependencies.xml
@@ -0,0 +1,24 @@
+
+ dep
+
+ jar
+
+ false
+
+
+ /
+ true
+ true
+ runtime
+
+ commons-lang:commons-lang
+ log4j:log4j
+ sun-jaxb:jaxb-api
+ sun-jaxb:jaxb-impl
+
+
+
+
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/FlatFile.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/FlatFile.java
new file mode 100644
index 0000000..9285ba6
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/FlatFile.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit;
+
+import java.util.Collection;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+public interface FlatFile extends TextListStream {
+
+ // Registros individuais
+
+ public G createRecord(String idType);
+
+ public FlatFile addRecord(G record);
+
+ public G getRecord(String idName);
+
+ public G removeRecord(String idName);
+
+ // Grupos de Registros (Registros que se repetem)
+
+ public FlatFile addRecords(String idName, Collection records);
+
+ public FlatFile setRecords(String idName, Collection records);
+
+ public Collection getRecords(String idName);
+
+ // Todos os Registros
+
+ public FlatFile addAllRecords(Collection records);
+
+ public FlatFile setAllRecords(Collection records);
+
+ public Collection getAllRecords();
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/ReadWriteStream.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/ReadWriteStream.java
new file mode 100644
index 0000000..7e6eae9
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/ReadWriteStream.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:17:10
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:17:10
+ *
+ */
+
+package org.jrimum.texgit;
+
+import java.io.Serializable;
+
+/**
+ *
+ * Interface genérica e representativa de coisas que necessitam de operações de
+ * fluxo de escrita e leitura.
+ *
+ *
+ * @return Um valor no mesmo tipo do tipo parametrizado
+ * @since 0.2
+ */
+ G write();
+
+ /**
+ *
+ * Lê o tipo informado.
+ *
+ *
+ * @param g - Valor a ser lido
+ *
+ * @since 0.2
+ */
+ void read(G g);
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/Record.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/Record.java
new file mode 100644
index 0000000..5e9034e
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/Record.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit;
+
+import java.util.List;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public interface Record extends TextStream {
+
+ public Record setValue(String fieldName, G value);
+
+ public G getValue(String fieldName);
+
+ public Record addInnerRecord(Record record);
+
+ public List getInnerRecords();
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/Texgit.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/Texgit.java
new file mode 100644
index 0000000..1875f18
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/Texgit.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jrimum.texgit.engine.TexgitManager;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public final class Texgit {
+
+ public static final FlatFile createFlatFile(String xmlDefFilePath)
+ throws TexgitException {
+
+ try {
+
+ if (isNotBlank(xmlDefFilePath))
+ return createFlatFile(new File(xmlDefFilePath));
+
+ } catch (Exception e) {
+ throw new TexgitException(e);
+ }
+
+ return null;
+ }
+
+ public static final FlatFile createFlatFile(File xmlDefFile)
+ throws TexgitException {
+
+ try {
+
+ if (isNotNull(xmlDefFile)) {
+
+ return createFlatFile(new FileInputStream(xmlDefFile));
+ }
+
+ } catch (Exception e) {
+ throw new TexgitException(e);
+ }
+
+ return null;
+ }
+
+ public static final FlatFile createFlatFile(URL xmlDefUrl)
+ throws TexgitException {
+
+ try {
+
+ if (isNotNull(xmlDefUrl)) {
+
+ return TexgitManager.buildFlatFile(xmlDefUrl.openStream());
+ }
+
+ } catch (Exception e) {
+ throw new TexgitException(e);
+ }
+
+
+ return null;
+ }
+
+ public static final FlatFile createFlatFile(byte[] xmlDefBytes)
+ throws TexgitException {
+
+ try {
+
+ if (isNotNull(xmlDefBytes)) {
+
+ return TexgitManager.buildFlatFile(new ByteArrayInputStream(xmlDefBytes));
+ }
+
+ } catch (Exception e) {
+ throw new TexgitException(e);
+ }
+
+ return null;
+ }
+
+ public static final FlatFile createFlatFile(InputStream xmlDefStream)
+ throws TexgitException {
+
+ if (isNotNull(xmlDefStream)) {
+
+ return TexgitManager.buildFlatFile(xmlDefStream);
+ }
+
+ return null;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/TexgitException.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/TexgitException.java
new file mode 100644
index 0000000..a7c4619
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/TexgitException.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit;
+
+/**
+ *
+ *
+ * Invólucro para exceções ocorridas no componente.
+ *
+ *
+ * @author Gilmar P.S.L.
+ *
+ * */
+@SuppressWarnings("serial")
+public class TexgitException extends RuntimeException {
+
+ /**
+ *
+ */
+ public TexgitException() {
+ super();
+
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public TexgitException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ }
+
+ /**
+ * @param arg0
+ */
+ public TexgitException(String arg0) {
+ super(arg0);
+
+ }
+
+ /**
+ * @param arg0
+ */
+ public TexgitException(Throwable arg0) {
+ super(arg0);
+
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/TextListStream.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/TextListStream.java
new file mode 100644
index 0000000..d1b966f
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/TextListStream.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit;
+
+import java.util.List;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public interface TextListStream extends ReadWriteStream> {
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/TextStream.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/TextStream.java
new file mode 100644
index 0000000..d5146e9
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/TextStream.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:17:20
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:17:20
+ *
+ */
+
+package org.jrimum.texgit;
+
+
+/**
+ *
Interface usada para objetos com serviços de leitura e escrita de textos.
+ *
+ * @author Gilmar P.S.L
+ * @author Misael Barreto
+ * @author Rômulo Augusto
+ * @author Nordeste Fomento
+ * Mercantil
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public interface TextStream extends ReadWriteStream {
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FixedFieldBuilder.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FixedFieldBuilder.java
new file mode 100644
index 0000000..4d646be
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FixedFieldBuilder.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.apache.commons.lang.StringUtils.countMatches;
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.jrimum.texgit.TexgitException;
+import org.jrimum.texgit.language.EnumFormats;
+import org.jrimum.texgit.language.EnumFormatsTypes;
+import org.jrimum.texgit.language.MetaField;
+import org.jrimum.texgit.type.Filler;
+import org.jrimum.texgit.type.component.Fillers;
+import org.jrimum.texgit.type.component.FixedField;
+import org.jrimum.texgit.type.component.Side;
+import org.jrimum.utilix.Dates;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+class FixedFieldBuilder {
+
+ private final static String BASE_DECIMAL_FORMAT = "0.";
+
+ static FixedField> build(MetaField metaField) {
+
+ FixedField> fixedField = null;
+
+ try {
+
+ fixedField = getInstance(metaField);
+
+ } catch (ParseException e) {
+ throw new TexgitException("Field: " + metaField.getName(), e);
+ }
+
+ return fixedField;
+ }
+
+ private static FixedField> getInstance(MetaField metaField)
+ throws ParseException {
+
+ FixedField> fField = null;
+
+ Format formatter = getFormater(metaField);
+
+ switch (metaField.getType()) {
+
+ case CHARACTER:
+ FixedField fCHR = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ if(metaField.getValue().length() == 1)
+ fCHR.setValue(metaField.getValue().charAt(0));
+ else
+ throw new IllegalArgumentException("Tipo character deve ter apenas 1!");
+ else
+ fCHR.setValue(' ');
+ fField = fCHR;
+ break;
+ case STRING:
+ FixedField fSTR = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fSTR.setValue(metaField.getValue());
+ else
+ fSTR.setValue(EMPTY);
+ fField = fSTR;
+ break;
+ case INTEGER:
+ FixedField fINT = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fINT.setValue(Integer.parseInt(metaField.getValue()));
+ else
+ fINT.setValue(Integer.valueOf(0));
+ fField = fINT;
+ break;
+ case LONG:
+ FixedField fLNG = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fLNG.setValue(Long.parseLong(metaField.getValue()));
+ else
+ fLNG.setValue(Long.valueOf(0));
+ fField = fLNG;
+ break;
+ case FLOAT:
+ FixedField fFLT = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fFLT.setValue(Float.parseFloat(metaField.getValue()));
+ else
+ fFLT.setValue(Float.valueOf(0));
+ fField = fFLT;
+ break;
+ case DOUBLE:
+ FixedField fDBE = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fDBE.setValue(Double.parseDouble(metaField.getValue()));
+ else
+ fDBE.setValue(Double.valueOf(0));
+ fField = fDBE;
+ break;
+ case BIGDECIMAL:
+ FixedField fBDL = new FixedField();
+ if (isNotBlank(metaField.getValue()))
+ fBDL.setValue(new BigDecimal(DecimalFormat.class
+ .cast(formatter).parse(metaField.getValue())
+ .doubleValue()));
+ else
+ fBDL.setValue(BigDecimal.ZERO);
+ fField = fBDL;
+ break;
+ case DATE:
+ FixedField fDTE = new FixedField();
+ if (isNotBlank(metaField.getValue())){
+
+ fDTE.setValue(DateFormat.class.cast(formatter).parse(
+ metaField.getValue()));
+ }
+ else{
+
+ fDTE.setValue(Dates.invalidDate());
+ }
+ fField = fDTE;
+ break;
+ }
+
+ fField.setName(metaField.getName());
+ fField.setFixedLength(metaField.getLength());
+ fField.setFiller(getFiller(metaField));
+ fField.setBlankAccepted(metaField.isBlankAccepted());
+ fField.setTruncate(metaField.isTruncate());
+
+ if(isNotNull(formatter))
+ fField.setFormatter(formatter);
+
+ return fField;
+ }
+
+ private static Filler getFiller(MetaField metaField) {
+
+ Filler filler = null;
+
+ if (isNotNull(metaField.getFiller())) {
+
+ org.jrimum.texgit.type.component.Filler filr = new org.jrimum.texgit.type.component.Filler();
+ filr.setPadding(metaField.getFiller().getPadding());
+ filr.setSideToFill(Side.valueOf(metaField.getFiller()
+ .getSideToFill().name()));
+ filler = filr;
+
+ } else {
+ filler = Fillers.valueOf(metaField.getPadding().name());
+ }
+
+ return filler;
+ }
+
+ private static Format getFormater(MetaField metaField) {
+
+ Format formatter = null;
+
+ if (isNotNull(metaField.getFormatter())) {
+
+ formatter = buildFormat(metaField.getFormatter().getFormat(),
+ metaField.getFormatter().getType());
+
+ } else {
+ if(isNotNull(metaField.getFormat())){
+
+ EnumFormats format = metaField.getFormat();
+
+ EnumFormatsTypes type = EnumFormatsTypes.valueOf(format.name()
+ .split("_")[0]);
+
+ formatter = buildFormat(buildFormat(format, type), type);
+ }
+ }
+
+ return formatter;
+ }
+
+ private static Format buildFormat(String strFormat, EnumFormatsTypes type) {
+
+ Format format = null;
+
+ switch (type) {
+
+ case DATE:
+ format = new SimpleDateFormat(strFormat);
+ break;
+ case DECIMAL:
+ format = new DecimalFormat(strFormat);
+ break;
+ }
+
+ return format;
+ }
+
+ private static String buildFormat(EnumFormats format, EnumFormatsTypes type) {
+
+ String strFormat = EMPTY;
+ /*
+ * DATE_DDMMYY, DATE_DDMMYYYY, DATE_YYMMDD, DATE_YYYYMMDD,
+ * DECIMAL_D,DECIMAL_DD, DECIMAL_DDD, DECIMAL_DDDD;
+ */
+ String defFormat = format.name().split("_")[1];
+
+ switch (type) {
+ case DATE:
+
+ defFormat = defFormat.replaceAll("D", "d");
+ strFormat = defFormat.replaceAll("Y", "y");
+
+ break;
+ case DECIMAL:
+
+ int lengthToFill = BASE_DECIMAL_FORMAT.length()
+ + countMatches(defFormat, "D");
+
+ strFormat = Fillers.ZERO_RIGHT.fill(
+ BASE_DECIMAL_FORMAT, lengthToFill);
+
+ break;
+ }
+
+ return strFormat;
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FlatFileBuilder.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FlatFileBuilder.java
new file mode 100644
index 0000000..47e9517
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/FlatFileBuilder.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jrimum.texgit.language.MetaFlatFile;
+import org.jrimum.texgit.language.MetaRecord;
+import org.jrimum.texgit.type.component.FlatFile;
+
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public class FlatFileBuilder {
+
+ static FlatFile build(MetaFlatFile mFlatFile) {
+
+ FlatFile ff = null;
+
+ List metaRecords = mFlatFile.getGroupOfRecords().getRecords();
+
+ ff = new FlatFile(new RecordFactory(metaRecords));
+
+ Set repitables = new HashSet();
+
+ List recordsOrder = new ArrayList();
+
+ if (isNotNull(metaRecords)) {
+
+ if (!metaRecords.isEmpty()) {
+
+ for (MetaRecord mRec : metaRecords) {
+
+ recordsOrder.add(mRec.getName());
+
+ if (mRec.isRepeatable())
+ repitables.add(mRec.getName());
+ }
+ }
+ }
+
+ ff.setRecordsOrder(recordsOrder);
+ ff.setRepitablesRecords(repitables);
+
+ return ff;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordBuilder.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordBuilder.java
new file mode 100644
index 0000000..4378bd8
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordBuilder.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import static org.jrimum.utilix.Objects.isNotNull;
+import static org.jrimum.utilix.Objects.isNull;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jrimum.texgit.language.MetaField;
+import org.jrimum.texgit.language.MetaOrderedField;
+import org.jrimum.texgit.language.MetaRecord;
+import org.jrimum.texgit.type.component.FixedField;
+import org.jrimum.texgit.type.component.Record;
+
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+class RecordBuilder {
+
+ @SuppressWarnings("unchecked")
+ static Record build(MetaRecord metaRecord) {
+
+ int strLength = getStringLength(metaRecord.getGroupOfFields().getFields());
+ int fldSize = metaRecord.getGroupOfFields().getFields().size();
+
+ MetaOrderedField id = metaRecord.getGroupOfFields().getIdType();
+ MetaOrderedField sequencialNumber = metaRecord.getGroupOfFields().getSequencialNumber();
+
+ if(isNotNull(id)){
+ fldSize += 1;
+ strLength += id.getLength();
+ }
+
+ if(isNotNull(sequencialNumber)){
+ fldSize += 1;
+ strLength += sequencialNumber.getLength();
+ }
+
+ Record record = new Record(strLength,fldSize);
+
+ record.setName(metaRecord.getName());
+ record.setDescription(metaRecord.getDescription());
+
+ /*
+ * getPossition eh de 1 a X
+ * e nao de 0 a X.
+ */
+ if(isNotNull(id)){
+ record.setIdType((FixedField) FixedFieldBuilder.build(id));
+ record.set(id.getPosition()-1, record.getIdType());
+ }
+
+ if(isNotNull(sequencialNumber)){
+ record.setSequencialNumber((FixedField) FixedFieldBuilder.build(sequencialNumber));
+ record.set(sequencialNumber.getPosition()-1,record.getSequencialNumber());
+ }
+
+ List fields = metaRecord.getGroupOfFields().getFields();
+
+ /*
+ * As somas sao para caso id ou sequencia jah
+ * estejam na devida posicao.
+ */
+ for(MetaField mField : fields){
+
+ if(isNull(record.get(fields.indexOf(mField))))
+ record.set(fields.indexOf(mField), FixedFieldBuilder.build(mField));
+ else
+ if(isNull(record.get(fields.indexOf(mField)+1)))
+ record.set(fields.indexOf(mField) + 1, FixedFieldBuilder.build(mField));
+ else
+ record.set(fields.indexOf(mField) + 2, FixedFieldBuilder.build(mField));
+ }
+
+ // innerRecords
+ if (isNotNull(metaRecord.getGroupOfInnerRecords())){
+
+ record.setHeadOfGroup(true);
+ record.setDeclaredInnerRecords(new ArrayList(metaRecord.getGroupOfInnerRecords().getRecords().size()));
+ record.setRepitablesRecords(new HashSet());
+
+ List metaInnerRecords = metaRecord.getGroupOfInnerRecords().getRecords();
+
+ for(MetaRecord mRecord : metaInnerRecords){
+ record.getDeclaredInnerRecords().add(mRecord.getName());
+ if(mRecord.isRepeatable())
+ record.getRepitablesRecords().add(mRecord.getName());
+ }
+
+ }else
+ record.setHeadOfGroup(false);
+
+ return record;
+ }
+
+ private static int getStringLength(List fields){
+ int length = 0;
+
+ for(MetaField mField : fields)
+ length += mField.getLength();
+
+ return length;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordFactory.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordFactory.java
new file mode 100644
index 0000000..c218e49
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/RecordFactory.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jrimum.texgit.language.MetaRecord;
+import org.jrimum.texgit.type.component.Record;
+
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public class RecordFactory implements org.jrimum.texgit.type.component.RecordFactory {
+
+ private Map name_record;
+
+ RecordFactory(List metaRecords) {
+
+ if (isNotNull(metaRecords)) {
+ if (!metaRecords.isEmpty()) {
+
+ name_record = new HashMap(metaRecords
+ .size());
+
+ for (MetaRecord mRecord : metaRecords) {
+
+ name_record.put(mRecord.getName(), mRecord);
+
+ if (isNotNull(mRecord.getGroupOfInnerRecords()))
+ loadInnerRecords(name_record, mRecord
+ .getGroupOfInnerRecords().getRecords());
+ }
+ }
+ }
+ }
+
+ private void loadInnerRecords(Map name_record,
+ List innerMetaRecords) {
+
+ if (isNotNull(innerMetaRecords)) {
+ if (!innerMetaRecords.isEmpty()) {
+
+ for (MetaRecord iMetaRecord : innerMetaRecords) {
+
+ name_record.put(iMetaRecord.getName(), iMetaRecord);
+
+ if (isNotNull(iMetaRecord.getGroupOfInnerRecords()))
+ loadInnerRecords(name_record, iMetaRecord
+ .getGroupOfInnerRecords().getRecords());
+ }
+ }
+ }
+
+ }
+
+ public Record create(String name) {
+
+ Record record = null;
+
+ if (isNotBlank(name))
+ if (name_record.containsKey(name))
+ record = RecordBuilder.build(name_record.get(name));
+
+ return record;
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitLanguageException.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitLanguageException.java
new file mode 100644
index 0000000..582b047
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitLanguageException.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import org.jrimum.texgit.TexgitException;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+@SuppressWarnings("serial")
+public class TexgitLanguageException extends TexgitException {
+
+ /**
+ *
+ */
+ public TexgitLanguageException() {
+ super();
+
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public TexgitLanguageException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ }
+
+ /**
+ * @param arg0
+ */
+ public TexgitLanguageException(String arg0) {
+ super(arg0);
+
+ }
+
+ /**
+ * @param arg0
+ */
+ public TexgitLanguageException(Throwable arg0) {
+ super(arg0);
+
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitManager.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitManager.java
new file mode 100644
index 0000000..db8398b
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitManager.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import java.io.InputStream;
+
+import org.jrimum.texgit.FlatFile;
+import org.jrimum.texgit.Record;
+import org.jrimum.texgit.TexgitException;
+import org.jrimum.texgit.language.MetaTexgit;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public class TexgitManager {
+
+ public static FlatFile buildFlatFile(InputStream xmlDefStream) {
+
+ FlatFile iFlatFile = null;
+
+ try {
+
+ MetaTexgit tgMeta = TexgitXmlReader.parse(xmlDefStream);
+
+ iFlatFile = FlatFileBuilder.build(tgMeta.getFlatFile());
+
+ } catch (Exception e) {
+ throw new TexgitException(e);
+ }
+
+ return iFlatFile;
+ }
+}
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitSchemaValidator.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitSchemaValidator.java
new file mode 100644
index 0000000..c6d36e6
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitSchemaValidator.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.ValidationEventLocator;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+class TexgitSchemaValidator implements ValidationEventHandler {
+
+ public boolean handleEvent(ValidationEvent event) {
+
+ boolean handled = false;
+
+ if (event.getSeverity() == ValidationEvent.WARNING) {
+
+ System.err.println(getMensagem("ATENÇÃO LAYOUT INCONSISTENTE!\n",
+ event));
+
+ handled = true;
+
+ } else
+ // ERROR
+ System.err.println(getMensagem("ERRO NO LAYOUT!\n", event));
+
+ return handled;
+ }
+
+ private String getMensagem(String msg, ValidationEvent event) {
+
+ ValidationEventLocator local = event.getLocator();
+
+ return msg +
+
+ "Linha { " + local.getLineNumber() + " } " + "Conluna [ "
+ + local.getColumnNumber() + " ] " + event.getMessage();
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitXmlReader.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitXmlReader.java
new file mode 100644
index 0000000..eb8ae62
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/engine/TexgitXmlReader.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.engine;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.jrimum.texgit.Texgit;
+import org.jrimum.texgit.TexgitException;
+import org.jrimum.texgit.language.MetaTexgit;
+import org.jrimum.utilix.ClassLoaders;
+import org.xml.sax.SAXException;
+
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+class TexgitXmlReader {
+
+ public static MetaTexgit parse(InputStream xmlDefStream) throws TexgitException {
+
+ MetaTexgit txg = null;
+
+ if (isNotNull(xmlDefStream)) {
+
+ try {
+
+ JAXBContext aJaxbContext = JAXBContext
+ .newInstance(MetaTexgit.class);
+
+ Unmarshaller aUnmarshaller = aJaxbContext.createUnmarshaller();
+
+ SchemaFactory aSchemaFactory = SchemaFactory
+ .newInstance(W3C_XML_SCHEMA_NS_URI);
+
+ Schema schema = aSchemaFactory.newSchema(ClassLoaders.getResource("TexgitSchema.xsd",Texgit.class));
+
+ aUnmarshaller.setSchema(schema);
+
+ aUnmarshaller.setEventHandler(new TexgitSchemaValidator());
+
+ txg = (MetaTexgit) aUnmarshaller.unmarshal(xmlDefStream);
+
+ } catch (SAXException e) {
+
+ throw new TexgitLanguageException(e);
+
+ } catch (JAXBException e) {
+
+ throw new TexgitLanguageException(e);
+
+ }
+ }
+
+ return txg;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormats.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormats.java
new file mode 100644
index 0000000..cae6e78
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormats.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ *
+ *
+ *
+ * Formatos pr� definidos suportados pelo componente.
+ *
+ *
+ *
+ *
+ *
+ * Java class for enumFormats.
+ *
+ *
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ *
+ */
+@XmlEnum
+public enum EnumFormats {
+
+ DATE_DDMMYY, DATE_DDMMYYYY, DATE_YYMMDD, DATE_YYYYMMDD, DECIMAL_D, DECIMAL_DD, DECIMAL_DDD, DECIMAL_DDDD;
+
+ public String value() {
+ return name();
+ }
+
+ public static EnumFormats fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormatsTypes.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormatsTypes.java
new file mode 100644
index 0000000..45ccb6b
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumFormatsTypes.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ *
+ *
+ *
+ * Tipo de formatadores suportados. Usados junto a defini��o de novos
+ * formatadores.
+ *
+ *
+ *
+ *
+ *
+ * Java class for enumFormatsTypes.
+ *
+ *
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ *
+ */
+@XmlEnum
+public enum EnumFormatsTypes {
+
+ DATE, DECIMAL;
+
+ public String value() {
+ return name();
+ }
+
+ public static EnumFormatsTypes fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumPaddings.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumPaddings.java
new file mode 100644
index 0000000..10c1693
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumPaddings.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ *
+ *
+ *
+ * Preenchimentos suportados por padr�o pelo componente.
+ *
+ *
+ *
+ *
+ *
+ * Java class for enumPaddings.
+ *
+ *
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ *
+ */
+@XmlEnum
+public enum EnumPaddings {
+
+ ZERO_RIGHT, ZERO_LEFT, WHITE_SPACE_RIGHT, WHITE_SPACE_LEFT;
+
+ public String value() {
+ return name();
+ }
+
+ public static EnumPaddings fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumSide.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumSide.java
new file mode 100644
index 0000000..9dc6674
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumSide.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ *
+ *
+ *
+ * Basicamente s�o defini��es de dire��es de escrita e leitura.
+ *
+ *
+ *
+ *
+ *
+ * Java class for enumSide.
+ *
+ *
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ *
+ */
+@XmlEnum
+public enum EnumSide {
+
+ LEFT, RIGHT;
+
+ public String value() {
+ return name();
+ }
+
+ public static EnumSide fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumTypes.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumTypes.java
new file mode 100644
index 0000000..794d7e0
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/EnumTypes.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ *
+ *
+ *
+ * Tipos usados para obten��o dos campos de texto para java. No caso representa
+ * os tipos java poss�veis para um campo.
+ *
+ *
+ *
+ *
+ *
+ * Java class for enumTypes.
+ *
+ *
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ *
+ */
+@XmlEnum
+public enum EnumTypes {
+
+ CHARACTER, STRING, INTEGER, LONG, FLOAT, DOUBLE, BIGDECIMAL, DATE;
+
+ public String value() {
+ return name();
+ }
+
+ public static EnumTypes fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaField.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaField.java
new file mode 100644
index 0000000..a545f98
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaField.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Field � a unidade b�sica de informa��o de um registro, um field est� para um
+ * registro assim como uma coluna de banco de dados est� para uma tabela.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaField", propOrder = {
+
+})
+public class MetaField {
+
+ @XmlElement(name = "Filler")
+ protected MetaFiller filler;
+ @XmlElement(name = "Formatter")
+ protected MetaFormatter formatter;
+ @XmlAttribute
+ protected Boolean blankAccepted;
+ @XmlAttribute
+ protected Boolean truncate;
+ @XmlAttribute
+ protected EnumFormats format;
+ @XmlAttribute(required = true)
+ protected int length;
+ @XmlAttribute(required = true)
+ protected String name;
+ @XmlAttribute
+ protected EnumPaddings padding;
+ @XmlAttribute
+ protected EnumTypes type;
+ @XmlAttribute
+ protected String value;
+
+ /**
+ * Gets the value of the filler property.
+ *
+ * @return possible object is {@link MetaFiller }
+ *
+ */
+ public MetaFiller getFiller() {
+ return filler;
+ }
+
+ /**
+ * Sets the value of the filler property.
+ *
+ * @param value
+ * allowed object is {@link MetaFiller }
+ *
+ */
+ public void setFiller(MetaFiller value) {
+ this.filler = value;
+ }
+
+ /**
+ * Gets the value of the formatter property.
+ *
+ * @return possible object is {@link MetaFormatter }
+ *
+ */
+ public MetaFormatter getFormatter() {
+ return formatter;
+ }
+
+ /**
+ * Sets the value of the formatter property.
+ *
+ * @param value
+ * allowed object is {@link MetaFormatter }
+ *
+ */
+ public void setFormatter(MetaFormatter value) {
+ this.formatter = value;
+ }
+
+ /**
+ * Gets the value of the blankAccepted property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ public boolean isBlankAccepted() {
+ if (blankAccepted == null) {
+ return false;
+ } else {
+ return blankAccepted;
+ }
+ }
+
+ /**
+ * Sets the value of the blankAccepted property.
+ *
+ * @param value
+ * allowed object is {@link Boolean }
+ *
+ */
+ public void setBlankAccepted(Boolean value) {
+ this.blankAccepted = value;
+ }
+
+ /**
+ * Gets the value of the truncate property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ public boolean isTruncate() {
+ if (truncate == null) {
+ return false;
+ } else {
+ return truncate;
+ }
+ }
+
+ /**
+ * Sets the value of the blankAccepted property.
+ *
+ * @param value
+ * allowed object is {@link Boolean }
+ *
+ */
+ public void setTruncate(Boolean value) {
+ this.truncate = value;
+ }
+
+ /**
+ * Gets the value of the format property.
+ *
+ * @return possible object is {@link EnumFormats }
+ *
+ */
+ public EnumFormats getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets the value of the format property.
+ *
+ * @param value
+ * allowed object is {@link EnumFormats }
+ *
+ */
+ public void setFormat(EnumFormats value) {
+ this.format = value;
+ }
+
+ /**
+ * Gets the value of the length property.
+ *
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * Sets the value of the length property.
+ *
+ */
+ public void setLength(int value) {
+ this.length = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the padding property.
+ *
+ * @return possible object is {@link EnumPaddings }
+ *
+ */
+ public EnumPaddings getPadding() {
+ if (padding == null) {
+ return EnumPaddings.WHITE_SPACE_RIGHT;
+ } else {
+ return padding;
+ }
+ }
+
+ /**
+ * Sets the value of the padding property.
+ *
+ * @param value
+ * allowed object is {@link EnumPaddings }
+ *
+ */
+ public void setPadding(EnumPaddings value) {
+ this.padding = value;
+ }
+
+ /**
+ * Gets the value of the type property.
+ *
+ * @return possible object is {@link EnumTypes }
+ *
+ */
+ public EnumTypes getType() {
+ if (type == null) {
+ return EnumTypes.STRING;
+ } else {
+ return type;
+ }
+ }
+
+ /**
+ * Sets the value of the type property.
+ *
+ * @param value
+ * allowed object is {@link EnumTypes }
+ *
+ */
+ public void setType(EnumTypes value) {
+ this.type = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getValue() {
+ if (value == null) {
+ return " ";
+ } else {
+ return value;
+ }
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFiller.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFiller.java
new file mode 100644
index 0000000..0471294
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFiller.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jrimum.texgit.type.component.Side;
+
+/**
+ *
+ *
+ *
+ * Instrumento utilizado para preencher um field com um formato e caracteres pr�
+ * definidos.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaFiller")
+public class MetaFiller {
+
+ @XmlAttribute(required = true)
+ protected String padding;
+ @XmlAttribute
+ protected EnumSide sideToFill;
+
+ /**
+ * Gets the value of the padding property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getPadding() {
+ return padding;
+ }
+
+ /**
+ * Sets the value of the padding property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setPadding(String value) {
+ this.padding = value;
+ }
+
+ /**
+ * Gets the value of the sideToFill property.
+ *
+ * @return possible object is {@link Side }
+ *
+ */
+ public EnumSide getSideToFill() {
+ if (sideToFill == null) {
+ return EnumSide.LEFT;
+ } else {
+ return sideToFill;
+ }
+ }
+
+ /**
+ * Sets the value of the sideToFill property.
+ *
+ * @param value
+ * allowed object is {@link Side }
+ *
+ */
+ public void setSideToFill(EnumSide value) {
+ this.sideToFill = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFlatFile.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFlatFile.java
new file mode 100644
index 0000000..a98bdd2
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFlatFile.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Flat File � um tipo de arquivo texto com informa��es estruturadas com base em
+ * formata��es e estruturas pr� definidas. veja mais em (link).
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaFlatFile", propOrder = { "layout", "groupOfRecords" })
+public class MetaFlatFile {
+
+ protected MetaLayout layout;
+ @XmlElement(name = "GroupOfRecords", required = true)
+ protected MetaGroupRecords groupOfRecords;
+
+ /**
+ * Gets the value of the layout property.
+ *
+ * @return possible object is {@link MetaLayout }
+ *
+ */
+ public MetaLayout getLayout() {
+ return layout;
+ }
+
+ /**
+ * Sets the value of the layout property.
+ *
+ * @param value
+ * allowed object is {@link MetaLayout }
+ *
+ */
+ public void setLayout(MetaLayout value) {
+ this.layout = value;
+ }
+
+ /**
+ * Gets the value of the groupOfRecords property.
+ *
+ * @return possible object is {@link MetaGroupRecords }
+ *
+ */
+ public MetaGroupRecords getGroupOfRecords() {
+ return groupOfRecords;
+ }
+
+ /**
+ * Sets the value of the groupOfRecords property.
+ *
+ * @param value
+ * allowed object is {@link MetaGroupRecords }
+ *
+ */
+ public void setGroupOfRecords(MetaGroupRecords value) {
+ this.groupOfRecords = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFormatter.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFormatter.java
new file mode 100644
index 0000000..f751e9d
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaFormatter.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Formato utilizado por um Filler (Preenchedor).
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaFormatter")
+public class MetaFormatter {
+
+ @XmlAttribute(required = true)
+ protected String format;
+ @XmlAttribute(required = true)
+ protected EnumFormatsTypes type;
+
+ /**
+ * Gets the value of the format property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets the value of the format property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setFormat(String value) {
+ this.format = value;
+ }
+
+ /**
+ * Gets the value of the type property.
+ *
+ * @return possible object is {@link EnumFormatsTypes }
+ *
+ */
+ public EnumFormatsTypes getType() {
+ return type;
+ }
+
+ /**
+ * Sets the value of the type property.
+ *
+ * @param value
+ * allowed object is {@link EnumFormatsTypes }
+ *
+ */
+ public void setType(EnumFormatsTypes value) {
+ this.type = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupFields.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupFields.java
new file mode 100644
index 0000000..75f8a4b
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupFields.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+/**
+ *
+ *
+ *
+ * Agregado de fields.
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaGroupFields", propOrder = { "idType", "fields",
+ "sequencialNumber" })
+public class MetaGroupFields {
+
+ @XmlElement(name = "IdType", required = true)
+ protected MetaOrderedField idType;
+ @XmlElement(name = "Field", required = true)
+ protected List fields;
+ @XmlElement(name = "SequencialNumber")
+ protected MetaOrderedField sequencialNumber;
+
+ /**
+ * Gets the value of the idType property.
+ *
+ * @return possible object is {@link MetaOrderedField }
+ *
+ */
+ public MetaOrderedField getIdType() {
+ return idType;
+ }
+
+ /**
+ * Sets the value of the idType property.
+ *
+ * @param value
+ * allowed object is {@link MetaOrderedField }
+ *
+ */
+ public void setIdType(MetaOrderedField value) {
+ this.idType = value;
+ }
+
+ /**
+ * Gets the value of the fields property.
+ *
+ *
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * set method for the fields property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ *
+ * getFields().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link MetaField }
+ *
+ *
+ */
+ public List getFields() {
+ if (fields == null) {
+ fields = new ArrayList();
+ }
+ return this.fields;
+ }
+
+ /**
+ * Gets the value of the sequencialNumber property.
+ *
+ * @return possible object is {@link MetaOrderedField }
+ *
+ */
+ public MetaOrderedField getSequencialNumber() {
+ return sequencialNumber;
+ }
+
+ /**
+ * Sets the value of the sequencialNumber property.
+ *
+ * @param value
+ * allowed object is {@link MetaOrderedField }
+ *
+ */
+ public void setSequencialNumber(MetaOrderedField value) {
+ this.sequencialNumber = value;
+ }
+
+ public static class IdType extends JAXBElement {
+
+ /**
+ * {@code serialVersionUID = -8934480908648452108L}
+ */
+ private static final long serialVersionUID = -8934480908648452108L;
+
+ protected final static QName NAME = new QName("", "IdType");
+
+ public IdType(MetaOrderedField value) {
+ super(NAME, ((Class) MetaOrderedField.class),
+ MetaGroupFields.class, value);
+ }
+
+ }
+
+ public static class SequencialNumber extends JAXBElement {
+
+ /**
+ * {@code serialVersionUID = 3923837730914132777L}
+ */
+ private static final long serialVersionUID = 3923837730914132777L;
+
+ protected final static QName NAME = new QName("", "SequencialNumber");
+
+ public SequencialNumber(MetaOrderedField value) {
+ super(NAME, ((Class) MetaOrderedField.class),
+ MetaGroupFields.class, value);
+ }
+
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupRecords.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupRecords.java
new file mode 100644
index 0000000..da3b696
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaGroupRecords.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Conjunto de records de um flatfile ou relacionados a um outro record.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaGroupRecords", propOrder = { "records" })
+public class MetaGroupRecords {
+
+ @XmlElement(name = "Record", required = true)
+ protected List records;
+
+ /**
+ * Gets the value of the records property.
+ *
+ *
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a
+ * set method for the records property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ *
+ * getRecords().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link MetaRecord }
+ *
+ *
+ */
+ public List getRecords() {
+ if (records == null) {
+ records = new ArrayList();
+ }
+ return this.records;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaLayout.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaLayout.java
new file mode 100644
index 0000000..f2a0203
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaLayout.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Tags para informar o layout do flafile definido.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaLayout", propOrder = {
+
+})
+public class MetaLayout {
+
+ protected String name;
+ protected String version;
+ protected String description;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the version property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the value of the version property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaOrderedField.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaOrderedField.java
new file mode 100644
index 0000000..fae7f41
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaOrderedField.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Para defini��o da posi��o.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaOrderedField")
+public class MetaOrderedField extends MetaField {
+
+ @XmlAttribute(required = true)
+ protected int position;
+
+ /**
+ * Gets the value of the position property.
+ *
+ */
+ public int getPosition() {
+ return position;
+ }
+
+ /**
+ * Sets the value of the position property.
+ *
+ */
+ public void setPosition(int value) {
+ this.position = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaRecord.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaRecord.java
new file mode 100644
index 0000000..4b4db17
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaRecord.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Uma esp�cie de container de fields numa forma mais simples, usualmente �
+ * conhecido como Registro ou Bloco.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaRecord", propOrder = { "groupOfFields",
+ "groupOfInnerRecords" })
+public class MetaRecord {
+
+ @XmlElement(name = "GroupOfFields", required = true)
+ protected MetaGroupFields groupOfFields;
+ @XmlElement(name = "GroupOfInnerRecords")
+ protected MetaGroupRecords groupOfInnerRecords;
+ @XmlAttribute
+ protected String description;
+ @XmlAttribute
+ protected String name;
+ @XmlAttribute
+ protected Boolean repeatable;
+
+ /**
+ * Gets the value of the groupOfFields property.
+ *
+ * @return possible object is {@link MetaGroupFields }
+ *
+ */
+ public MetaGroupFields getGroupOfFields() {
+ return groupOfFields;
+ }
+
+ /**
+ * Sets the value of the groupOfFields property.
+ *
+ * @param value
+ * allowed object is {@link MetaGroupFields }
+ *
+ */
+ public void setGroupOfFields(MetaGroupFields value) {
+ this.groupOfFields = value;
+ }
+
+ /**
+ * Gets the value of the groupOfInnerRecords property.
+ *
+ * @return possible object is {@link MetaGroupRecords }
+ *
+ */
+ public MetaGroupRecords getGroupOfInnerRecords() {
+ return groupOfInnerRecords;
+ }
+
+ /**
+ * Sets the value of the groupOfInnerRecords property.
+ *
+ * @param value
+ * allowed object is {@link MetaGroupRecords }
+ *
+ */
+ public void setGroupOfInnerRecords(MetaGroupRecords value) {
+ this.groupOfInnerRecords = value;
+ }
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the repeatable property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ public boolean isRepeatable() {
+ if (repeatable == null) {
+ return false;
+ } else {
+ return repeatable;
+ }
+ }
+
+ /**
+ * Sets the value of the repeatable property.
+ *
+ * @param value
+ * allowed object is {@link Boolean }
+ *
+ */
+ public void setRepeatable(Boolean value) {
+ this.repeatable = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaTexgit.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaTexgit.java
new file mode 100644
index 0000000..9a5f245
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/MetaTexgit.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ *
+ *
+ *
+ * Elemento root.
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+@XmlRootElement(name = "Texgit")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MetaTexgit", propOrder = {
+
+})
+public class MetaTexgit {
+
+ @XmlElement(name = "FlatFile", required = true)
+ protected MetaFlatFile flatFile;
+ @XmlAttribute
+ protected String version;
+
+ /**
+ * Gets the value of the flatFile property.
+ *
+ * @return possible object is {@link MetaFlatFile }
+ *
+ */
+ public MetaFlatFile getFlatFile() {
+ return flatFile;
+ }
+
+ /**
+ * Sets the value of the flatFile property.
+ *
+ * @param value
+ * allowed object is {@link MetaFlatFile }
+ *
+ */
+ public void setFlatFile(MetaFlatFile value) {
+ this.flatFile = value;
+ }
+
+ /**
+ * Gets the value of the version property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getVersion() {
+ if (version == null) {
+ return "1.0-academic";
+ } else {
+ return version;
+ }
+ }
+
+ /**
+ * Sets the value of the version property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/ObjectFactory.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/ObjectFactory.java
new file mode 100644
index 0000000..7aca0eb
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/ObjectFactory.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+package org.jrimum.texgit.language;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+/**
+ * This object contains factory methods for each Java content interface and Java
+ * element interface generated in the texgit.language package.
+ *
+ * An ObjectFactory allows you to programatically construct new instances of the
+ * Java representation for XML content. The Java representation of XML content
+ * can consist of schema derived interfaces and classes representing the binding
+ * of schema type definitions, element declarations and model groups. Factory
+ * methods for each of these are provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName TEXGIT_QNAME = new QName(
+ "http://jrimum.org/texgit", "Texgit");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of
+ * schema derived classes for package: texgit.language
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link MetaField }
+ *
+ */
+ public MetaField createMetaField() {
+ return new MetaField();
+ }
+
+ /**
+ * Create an instance of {@link MetaFlatFile }
+ *
+ */
+ public MetaFlatFile createMetaFlatFile() {
+ return new MetaFlatFile();
+ }
+
+ /**
+ * Create an instance of {@link MetaOrderedField }
+ *
+ */
+ public MetaOrderedField createMetaOrderedField() {
+ return new MetaOrderedField();
+ }
+
+ /**
+ * Create an instance of {@link MetaRecord }
+ *
+ */
+ public MetaRecord createMetaRecord() {
+ return new MetaRecord();
+ }
+
+ /**
+ * Create an instance of {@link MetaLayout }
+ *
+ */
+ public MetaLayout createMetaLayout() {
+ return new MetaLayout();
+ }
+
+ /**
+ * Create an instance of {@link MetaTexgit }
+ *
+ */
+ public MetaTexgit createMetaTexgit() {
+ return new MetaTexgit();
+ }
+
+ /**
+ * Create an instance of {@link MetaFormatter }
+ *
+ */
+ public MetaFormatter createMetaFormatter() {
+ return new MetaFormatter();
+ }
+
+ /**
+ * Create an instance of {@link MetaGroupFields }
+ *
+ */
+ public MetaGroupFields createMetaGroupFields() {
+ return new MetaGroupFields();
+ }
+
+ /**
+ * Create an instance of {@link MetaGroupRecords }
+ *
+ */
+ public MetaGroupRecords createMetaGroupRecords() {
+ return new MetaGroupRecords();
+ }
+
+ /**
+ * Create an instance of {@link MetaFiller }
+ *
+ */
+ public MetaFiller createMetaFiller() {
+ return new MetaFiller();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link MetaTexgit }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jrimum.org/texgit", name = "Texgit")
+ public JAXBElement createTexgit(MetaTexgit value) {
+ return new JAXBElement(TEXGIT_QNAME, MetaTexgit.class,
+ null, value);
+ }
+
+ /**
+ * Create an instance of {@link MetaGroupFields.SequencialNumber }}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "SequencialNumber", scope = MetaGroupFields.class)
+ public MetaGroupFields.SequencialNumber createMetaGroupFieldsSequencialNumber(
+ MetaOrderedField value) {
+ return new MetaGroupFields.SequencialNumber(value);
+ }
+
+ /**
+ * Create an instance of {@link MetaGroupFields.IdType }}
+ *
+ */
+ @XmlElementDecl(namespace = "", name = "IdType", scope = MetaGroupFields.class)
+ public MetaGroupFields.IdType createMetaGroupFieldsIdType(
+ MetaOrderedField value) {
+ return new MetaGroupFields.IdType(value);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/language/package-info.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/package-info.java
new file mode 100644
index 0000000..caabf7a
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/language/package-info.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 03/08/2008 - 12:27:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 03/08/2008 - 12:27:56
+ *
+ */
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB)
+// Reference Implementation, vJAXB 2.0 in JDK 1.6
+// See http://java.sun.com/xml/jaxb
+// Any modifications to this file will be lost upon recompilation of the source
+// schema.
+// Generated on: 2008.08.03 at 12:27:56 AM GMT-03:00
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://jrimum.org/texgit")
+package org.jrimum.texgit.language;
+
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/AbstractStringOfFields.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/AbstractStringOfFields.java
new file mode 100644
index 0000000..27e200d
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/AbstractStringOfFields.java
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+import static java.lang.String.format;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.lang.StringUtils;
+import org.jrimum.texgit.TextStream;
+import org.jrimum.utilix.Collections;
+import org.jrimum.utilix.Objects;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractStringOfFields> implements TextStream, List, Cloneable{
+
+ /**
+ *
+ */
+ private ArrayList fields;
+
+ /**
+ *
+ */
+ public AbstractStringOfFields() {
+
+ fields = new ArrayList();
+ }
+
+ /**
+ *
+ */
+ public AbstractStringOfFields(Integer size) {
+
+ Objects.checkNotNull(size, "size");
+
+ if (size > 0) {
+ fields = new ArrayList(size);
+ for (int i = 1; i <= size; i++){
+ fields.add(null);
+ }
+ } else {
+ throw new IllegalArgumentException(format("A quantidade de campos [%s] deve ser um número natural > 0!", size));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected AbstractStringOfFields clone() throws CloneNotSupportedException {
+
+ //Clona apenas com uma referência a fields.
+ AbstractStringOfFields sof = (AbstractStringOfFields) super.clone();
+
+ //Clonagem real
+ sof.fields = new ArrayList();
+
+ for(G gf : fields)
+ sof.fields.add((G) gf.clone());
+
+ return sof;
+ }
+
+ /**
+ *
+ * A leitrua de uma string, ou melhor, a divisão de uma string em fields,
+ * não ocorre sem uma lógica. Assim este método deve ser implementado por
+ * cada subclasse.
+ *
+ * Escreve os campos na ordem em que estão dispostos na lista em uma única linha (string).
+ *
+ *
+ * @see org.jrimum.texgit.ReadWriteStream#write()
+ */
+ public String write() {
+
+ StringBuilder lineOfFields = new StringBuilder(StringUtils.EMPTY);
+
+ Objects.checkNotNull(fields, "Fields == null");
+ Collections.checkNotEmpty(fields, "Coleção de fields vazia!");
+
+ for (G field : fields) {
+
+ try {
+
+ lineOfFields.append(field.write());
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(
+ format(
+ "Erro ao tentar escrever o campo \"%s\" com valor [%s] na posição [%s] no layout do registro.",
+ field.getName(), field.getValue(), fields
+ .indexOf(field)+1),e);
+ }
+ }
+
+ return lineOfFields.toString();
+ }
+
+ /**
+ * @return the fields
+ */
+ public List getFields() {
+ return fields;
+ }
+
+ /**
+ * @see java.util.List#add(java.lang.Object)
+ */
+ public boolean add(G e) {
+
+ return fields.add(e);
+ }
+
+ /**
+ * @see java.util.List#add(int, java.lang.Object)
+ */
+ public void add(int index, G element) {
+
+ fields.add(index, element);
+ }
+
+ /**
+ * @see java.util.List#addAll(java.util.Collection)
+ */
+ public boolean addAll(Collection extends G> c) {
+
+ return fields.addAll(c);
+ }
+
+ /**
+ * @see java.util.List#addAll(int, java.util.Collection)
+ */
+ public boolean addAll(int index, Collection extends G> c) {
+
+ return fields.addAll(index, c);
+ }
+
+ /**
+ * @see java.util.List#clear()
+ */
+ public void clear() {
+
+ fields.clear();
+ }
+
+ /**
+ * @see java.util.List#contains(java.lang.Object)
+ */
+ public boolean contains(Object o) {
+
+ return fields.contains(o);
+ }
+
+ /**
+ * @see java.util.List#containsAll(java.util.Collection)
+ */
+ public boolean containsAll(Collection> c) {
+
+ return fields.containsAll(c);
+ }
+
+ /**
+ * @see java.util.List#get(int)
+ */
+ public G get(int index) {
+
+ return fields.get(index);
+ }
+
+ /**
+ * @see java.util.List#indexOf(java.lang.Object)
+ */
+ public int indexOf(Object o) {
+
+ return fields.indexOf(o);
+ }
+
+ /**
+ * @see java.util.List#isEmpty()
+ */
+ public boolean isEmpty() {
+
+ return fields.isEmpty();
+ }
+
+ /**
+ * @see java.util.List#iterator()
+ */
+ public Iterator iterator() {
+
+ return fields.iterator();
+ }
+
+ /**
+ * @see java.util.List#lastIndexOf(java.lang.Object)
+ */
+ public int lastIndexOf(Object o) {
+
+ return fields.indexOf(o);
+ }
+
+ /**
+ * @see java.util.List#listIterator()
+ */
+ public ListIterator listIterator() {
+
+ return fields.listIterator();
+ }
+
+ /**
+ * @see java.util.List#listIterator(int)
+ */
+ public ListIterator listIterator(int index) {
+
+ return fields.listIterator(index);
+ }
+
+ /**
+ * @see java.util.List#remove(int)
+ */
+ public G remove(int index) {
+
+ return fields.remove(index);
+ }
+
+ /**
+ * @see java.util.List#remove(java.lang.Object)
+ */
+ public boolean remove(Object o) {
+
+ return fields.remove(o);
+ }
+
+ /**
+ * @see java.util.List#removeAll(java.util.Collection)
+ */
+ public boolean removeAll(Collection> c) {
+
+ return fields.removeAll(c);
+ }
+
+ /**
+ * @see java.util.List#retainAll(java.util.Collection)
+ */
+ public boolean retainAll(Collection> c) {
+
+ return fields.retainAll(c);
+ }
+
+ /**
+ * @see java.util.List#set(int, java.lang.Object)
+ */
+ public G set(int index, G element) {
+
+ return fields.set(index, element);
+ }
+
+ /**
+ * @see java.util.List#size()
+ */
+ public int size() {
+
+ return fields.size();
+ }
+
+ /**
+ * @see java.util.List#subList(int, int)
+ */
+ public List subList(int fromIndex, int toIndex) {
+
+ return fields.subList(fromIndex, toIndex);
+ }
+
+ /**
+ * @see java.util.List#toArray()
+ */
+ public Object[] toArray() {
+
+ return fields.toArray();
+ }
+
+ /**
+ * @see java.util.List#toArray(Object[])
+ */
+ public T[] toArray(T[] a) {
+
+ return fields.toArray(a);
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Field.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Field.java
new file mode 100644
index 0000000..5153406
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Field.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+import java.text.Format;
+
+import org.jrimum.texgit.TextStream;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+public interface Field extends TextStream, Cloneable{
+
+ public abstract String getName();
+
+ public abstract void setName(String name);
+
+ public abstract G getValue();
+
+ public abstract void setValue(G value);
+
+ public abstract Format getFormatter();
+
+ public abstract void setFormatter(Format formatter);
+
+ public abstract boolean isBlankAccepted();
+
+ public abstract void setBlankAccepted(boolean blankAccepted);
+
+ public abstract Field clone() throws CloneNotSupportedException;
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Filler.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Filler.java
new file mode 100644
index 0000000..7ee56e6
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Filler.java
@@ -0,0 +1,162 @@
+package org.jrimum.texgit.type;
+
+import java.io.Serializable;
+
+import org.jrimum.texgit.TextStream;
+
+public interface Filler extends Serializable{
+
+ /**
+ * Preenche o campo com o caracter especificado e no lado especificado.
+ *
+ *
+ * Exemplo:
+ *
+ * Se sideToFill == SideToFill.LEFT, o caracter especificado será adicionado à String
+ * no lado esquerdo até que o campo fique com o tamanho que foi definido.
+ *
+ * Caso toFill seja null, o método
+ * fill(String, int) receberá uma String nula como parâmetro.
+ *
+ *
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ *
+ * @see Filler#fill(String, int)
+ *
+ * @since 0.2
+ */
+ String fill(TextStream tofill, int length);
+}
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Fixed.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Fixed.java
new file mode 100644
index 0000000..1016799
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/Fixed.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public interface Fixed {
+
+ /**
+ * Informa a validade para a fixação de uma ou mais medidas. Exemplo:
+ *
+ *
+ *
+ * @return Indicativo se está de acordo com o definido
+ *
+ * @throws IllegalStateException
+ */
+ public abstract boolean isFixedAsDefined() throws IllegalStateException;
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedField.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedField.java
new file mode 100644
index 0000000..1320325
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedField.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+public interface FixedField extends Field, FixedLength{
+
+ /**
+ * @return the filler
+ */
+ public abstract Filler getFiller();
+
+ /**
+ * @param filler the filler to set
+ */
+ public abstract void setFiller(Filler filler);
+}
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedLength.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedLength.java
new file mode 100644
index 0000000..48f3a4d
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedLength.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public interface FixedLength extends Fixed{
+
+ public Integer getFixedLength();
+
+ public boolean isTruncate();
+
+ public void setTruncate(boolean truncate);
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedSize.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedSize.java
new file mode 100644
index 0000000..5918599
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/FixedSize.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public interface FixedSize extends Fixed{
+
+ public Integer getFixedSize();
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/BlockOfFields.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/BlockOfFields.java
new file mode 100644
index 0000000..351ac3b
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/BlockOfFields.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import org.jrimum.texgit.type.AbstractStringOfFields;
+import org.jrimum.texgit.type.FixedLength;
+import org.jrimum.texgit.type.FixedSize;
+import org.jrimum.utilix.Collections;
+import org.jrimum.utilix.Objects;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+@SuppressWarnings("serial")
+public class BlockOfFields extends AbstractStringOfFields> implements FixedSize, FixedLength{
+
+ /**
+ * Definição
+ */
+ private Integer length;
+
+ /**
+ * Definição
+ */
+ private Integer size;
+
+ /**
+ *
+ * Tamanho da string de escrita do bloco.
+ *
+ */
+ private Integer instantLength;
+
+ /**
+ *
+ * Ao ultrapassar o tamanho, define se pode truncar ou se dispara uma exceção.
+ *
+ */
+ private boolean truncate;
+
+ /**
+ *
+ */
+ public BlockOfFields() {
+ super();
+ }
+
+ /**
+ * @param length
+ * @param size
+ */
+ public BlockOfFields(Integer length, Integer size) {
+
+ super(size);
+
+ Objects.checkNotNull(length, "length");
+
+ if (length > 0) {
+
+ setLength(length);
+ setSize(size);
+
+ } else
+ throw new IllegalArgumentException(format("O comprimento do bloco [%s] deve ser um número natural > 0!", length));
+ }
+
+ @Override
+ public BlockOfFields clone() throws CloneNotSupportedException {
+
+ return(BlockOfFields) super.clone();
+ }
+
+ @Override
+ public void read(String lineOfFields) {
+
+ Objects.checkNotNull(lineOfFields, "String de leitura nula!");
+
+ Objects.checkNotNull(getFields(), "Fields == null");
+ Collections.checkNotEmpty(getFields(), "Coleção de fields vazia!");
+
+ if (isSizeAsDefinaed() && isLengthWithDefinaed(lineOfFields.length())) {
+
+ StringBuilder builder = new StringBuilder(lineOfFields);
+
+ for (FixedField> field : getFields()) {
+
+ try {
+
+ field.read(builder.substring(0, field.getFixedLength()));
+ builder.delete(0, field.getFixedLength());
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(
+ format(
+ "Erro ao tentar ler o campo \"%s\" na posição [%s] no layout do registro.",
+ field.getName(), getFields().indexOf(field)+1),e);
+ }
+ }
+
+ builder = null;
+ }
+ }
+
+ @Override
+ public String write() {
+
+ Objects.checkNotNull(getFields(), "Fields == null");
+ Collections.checkNotEmpty(getFields(), "Coleção de fields vazia!");
+
+ String str = null;
+
+ isSizeAsDefinaed();
+
+ str = super.write();
+
+ instantLength = str.length();
+
+ if (isTruncate() && instantLength > getFixedLength()) {
+ str = str.substring(0, getFixedLength());
+ instantLength = getFixedLength();
+ }
+
+ isFixedAsDefined();
+
+ return str;
+ }
+
+ public boolean isFixedAsDefined() throws IllegalStateException {
+
+ return (isSizeAsDefinaed() && isLengthWithDefinaed());
+ }
+
+ private boolean isLengthWithDefinaed(){
+
+ return isLengthWithDefinaed(instantLength);
+ }
+
+ private boolean isLengthWithDefinaed(int length){
+
+ if(length == getFixedLength())
+ return true;
+ else
+ throw new IllegalStateException(format("O comprimento da string [%s] é incompátivel com o definido [%s] no layout do registro!",length,getFixedLength()));
+ }
+
+ private boolean isSizeAsDefinaed(){
+
+ if(size() == getFixedSize())
+ return true;
+ else
+ throw new IllegalStateException(format("O número de fields [%s] é incompátivel com o definido [%s]!", size(), getFixedSize()));
+ }
+
+ /**
+ * @return the length
+ */
+ public Integer getFixedLength() {
+ return length;
+ }
+
+ /**
+ * @param length the length to set
+ */
+ protected void setLength(Integer length) {
+
+ if (isNotNull(length))
+ this.length = length;
+ else
+ throw new IllegalArgumentException(format("Comprimento inválido [%s]!", length));
+ }
+
+ /**
+ * @return the size
+ */
+ public Integer getFixedSize() {
+ return size;
+ }
+
+ /**
+ * @param size the size to set
+ */
+ protected void setSize(Integer size) {
+
+ if (isNotNull(size))
+ this.size = size;
+ else
+ throw new IllegalArgumentException(format("Tamanho inválido [%s]!", size));
+ }
+
+ public boolean isTruncate() {
+ return this.truncate;
+ }
+
+ public void setTruncate(boolean truncate) {
+ this.truncate = truncate;
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Field.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Field.java
new file mode 100644
index 0000000..2d38d80
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Field.java
@@ -0,0 +1,406 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.apache.commons.lang.StringUtils.isBlank;
+import static org.apache.commons.lang.StringUtils.isNumeric;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.lang.reflect.Constructor;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.Format;
+import java.text.ParseException;
+import java.util.Date;
+
+import org.jrimum.texgit.TextStream;
+import org.jrimum.utilix.Dates;
+import org.jrimum.utilix.Objects;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+@SuppressWarnings("serial")
+public class Field implements org.jrimum.texgit.type.Field{
+
+ /**
+ *
+ *Nome do campo, também pode ser usado como id.
+ *
+ */
+ private String name;
+
+ /**
+ *
+ * Valor do campo.
+ *
+ */
+ private G value;
+
+ /**
+ *
+ * Formatador utilizado na leitura e escrita do valor do campo.
+ *
+ */
+ private Format formatter;
+
+ /**
+ *
+ * Necessário para ler campos númericos em branco.
+ *
+ * Cria um Field com um valor e um formatador para o valor. Isto significa que a leitura e escrita do valor informado
+ * será de acordo com o formatador.
+ *
+ *
+ * @param value
+ * @param formatter
+ */
+ public Field(G value, Format formatter){
+
+ setValue(value);
+ setFormatter(formatter);
+ }
+
+ /**
+ * @param name
+ * @param value
+ */
+ public Field(String name, G value) {
+ super();
+ setName(name);
+ setValue(value);
+ }
+
+
+ /**
+ *
+ * Cria um Field com nome para identificação, valor e um formatador.
+ *
+ *
+ * @param name
+ * @param value
+ * @param formatter
+ *
+ * @see #Field(Object, Format)
+ */
+ public Field(String name, G value, Format formatter){
+
+ setName(name);
+ setValue(value);
+ setFormatter(formatter);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Field clone() throws CloneNotSupportedException {
+
+ return (Field) super.clone();
+ }
+
+ public void read(String str) {
+
+ Objects.checkNotNull(str, "String inválida [null]!");
+
+ try{
+
+ if (this.value instanceof TextStream) {
+
+ TextStream reader = (TextStream) this.value;
+ reader.read(str);
+
+ } else if (this.value instanceof BigDecimal) {
+
+ readDecimalField(str);
+
+ } else if (this.value instanceof Date) {
+
+ readDateField(str);
+
+ } else if (this.value instanceof Character) {
+
+ readCharacter(str);
+
+ } else {
+
+ readStringOrNumericField(str);
+ }
+
+ }catch (Exception e) {
+
+ throw new IllegalStateException(format("Falha na leitura do campo! %s",toString()),e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readCharacter(String str) {
+
+ if(str.length() == 1){
+
+ value = (G) new Character(str.charAt(0));
+
+ }else
+ throw new IllegalArgumentException("String com mais de 1 character!");
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readDecimalField(String str) {
+
+ DecimalFormat decimalFormat = (DecimalFormat) formatter;
+
+ try {
+
+ String number = parseNumber(str);
+
+ Long parsedValue = (Long) formatter.parseObject(number);
+
+ BigDecimal decimalValue = new BigDecimal(parsedValue.longValue());
+
+ decimalValue = decimalValue.movePointLeft(decimalFormat.getMaximumFractionDigits());
+
+ value = (G) decimalValue;
+
+ }
+ catch (ParseException e) {
+
+ throwReadError(e, str);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readDateField(String str) {
+
+ try {
+
+ if(isBlank(str)){
+
+ if(isBlankAccepted()){
+
+ value = (G) Dates.invalidDate();
+
+ }else{
+
+ new IllegalArgumentException(format("Campo data vazio não permitido: [%s]!",str));
+ }
+
+ }else{
+
+ value = (G) formatter.parseObject(str);
+ }
+
+ } catch (ParseException e) {
+
+ throwReadError(e, str);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readStringOrNumericField(String str) {
+
+ str = parseNumber(str);
+
+ Class> clazz = value.getClass();
+
+ if(clazz.equals(String.class)){
+ value = (G) str;
+ }else{
+ readNumeric(clazz,str);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readNumeric(Class> clazz, String str) {
+
+ for (Constructor> cons : clazz.getConstructors()) {
+
+ if (cons.getParameterTypes().length == 1){
+
+ if (cons.getParameterTypes()[0].equals(String.class)){
+ try {
+
+ value = (G) cons.newInstance(str);
+
+ } catch (Exception e) {
+
+ throwReadError(e, str);
+ }
+ }
+ }
+ }
+ }
+
+ public String write() {
+
+ try{
+
+ String str = null;
+
+ if (value instanceof TextStream) {
+
+ TextStream its = (TextStream) value;
+
+ str = its.write();
+
+ } else if (value instanceof Date) {
+
+ str = writeDateField();
+ }
+
+ else if (value instanceof BigDecimal)
+ str = writeDecimalField();
+
+ else
+ str = value.toString();
+
+ return str;
+
+ }catch (Exception e) {
+
+ throw new IllegalStateException(format("Falha na escrita do campo escrita! %s",toString()),e);
+ }
+ }
+
+ private String writeDecimalField(){
+
+ BigDecimal decimalValue = (BigDecimal) value;
+
+ decimalValue = decimalValue.movePointRight(((DecimalFormat)formatter).getMaximumFractionDigits());
+
+ return decimalValue.toString();
+ }
+
+ private String writeDateField(){
+
+ if (!Dates.equalsInvalidDate((Date) value)){
+
+ return formatter.format(value);
+ }
+
+ return EMPTY;
+ }
+
+ private String parseNumber(String str){
+
+ if(isBlank(str)){
+
+ if(isBlankAccepted())
+ str = "0";
+ else
+ new IllegalArgumentException(format("Campo numérico vazio não permitido: [%s]!",str));
+ }else
+ if(!isNumeric(str))
+ new IllegalArgumentException(format("O campo deve ser numérico e não: [%s]!",str));
+
+ return str;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+
+ if (isNotNull(name))
+ this.name = name;
+ else
+ throw new IllegalArgumentException(format("Nome Inválido: [%s]!",name));
+ }
+
+ public boolean isBlankAccepted() {
+ return this.blankAccepted;
+ }
+
+ public void setBlankAccepted(boolean blankAccepted) {
+ this.blankAccepted = blankAccepted;
+ }
+
+ public G getValue() {
+ return value;
+ }
+
+ public void setValue(G value) {
+
+ if (isNotNull(value))
+ this.value = value;
+ else
+ throw new IllegalArgumentException(format("Valor Inválido: %s = [%s]!", this.name, value));
+ }
+
+ public Format getFormatter() {
+ return formatter;
+ }
+
+ public void setFormatter(Format formatter) {
+
+ if (isNotNull(formatter))
+ this.formatter = formatter;
+ else
+ throw new IllegalArgumentException(format("Formato inválido: [%s]!",formatter));
+ }
+
+ private void throwReadError(Exception e, String value){
+
+ throw new IllegalArgumentException(format("Falha na leitura da string: [\"%s\"]! %s",value,toString()), e);
+ }
+
+ @Override
+ public String toString() {
+
+ return format("Field [name=\"%s\", value=\"%s\", isBlankAccepted=%s, formatter=%s]"
+ , Objects.whenNull(this.name, EMPTY)
+ , Objects.whenNull(this.value, EMPTY)
+ , Objects.whenNull(this.isBlankAccepted(), EMPTY)
+ , Objects.whenNull(this.formatter, EMPTY));
+
+ }
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Filler.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Filler.java
new file mode 100644
index 0000000..c693be6
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Filler.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:17:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:17:00
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import org.apache.commons.lang.StringUtils;
+import org.jrimum.texgit.TextStream;
+import org.jrimum.utilix.Objects;
+
+/**
+ *
+ * Preenchedor de caracteres genérico. É utilizado para preencher objetos String,
+ * tanto da esquerda para a direita como da direita para esquerda, com o objeto genérico até
+ * o tamanho especificado. Caso o tamanho especificado seja menor
+ * ou igual a 0 (ZERO), este valor será desconsiderado e nada será preenchido.
+ *
+ *
+ * É utilizado o método toString() do objeto preenchedor.
+ *
+ * @author Gilmar P.S.L
+ * @author Misael Barreto
+ * @author Rômulo Augusto
+ * @author Nordeste Fomento
+ * Mercantil
+ *
+ * @since JRimum 0.1
+ *
+ * @version 0.2.1-inc
+ *
+ */
+@SuppressWarnings("serial")
+public class Filler implements org.jrimum.texgit.type.Filler{
+
+ private G padding;
+
+ private Side sideToFill;
+
+ public Filler() {
+ super();
+ }
+
+ /**
+ * @param fillWith
+ */
+ public Filler(G fillWith) {
+
+ setPadding(fillWith);
+ setSideToFill(Side.LEFT);
+ }
+
+ /**
+ * @param fillWith
+ * @param sideToFill
+ */
+ public Filler(G fillWith, Side sideToFill) {
+
+ setPadding(fillWith);
+ setSideToFill(sideToFill);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#getPadding()
+ */
+ public G getPadding() {
+ return padding;
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#setPadding(G)
+ */
+ public void setPadding(G fillWith) {
+
+ if(isNotNull(fillWith)){
+ this.padding = fillWith;
+ }else{
+ throw new IllegalArgumentException(format("Preenchimento inválido [%s]!",fillWith));
+ }
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#getSideToFill()
+ */
+ public Side getSideToFill() {
+ return sideToFill;
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#setSideToFill(org.jrimum.texgit.type.component.Side)
+ */
+ public void setSideToFill(Side sideToFill) {
+
+ if(isNotNull(sideToFill)){
+ this.sideToFill = sideToFill;
+ }else{
+ throw new IllegalArgumentException(format("Lado para preenchimento [%s]!",sideToFill));
+ }
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(java.lang.String, int)
+ */
+ public String fill(String toFill, int length){
+
+ String str = null;
+
+ switch(sideToFill){
+
+ case LEFT:
+ str = fillLeft(toFill, length);
+ break;
+
+ case RIGHT:
+ str = fillRight(toFill, length);
+ break;
+ }
+
+ return str;
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(long, int)
+ */
+ public String fill(long tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(int, int)
+ */
+ public String fill(int tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(short, int)
+ */
+ public String fill(short tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(byte, int)
+ */
+ public String fill(byte tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(char, int)
+ */
+ public String fill(char tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(double, int)
+ */
+ public String fill(double tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(float, int)
+ */
+ public String fill(float tofill, int length){
+ return fill(String.valueOf(tofill), length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(java.lang.Object, int)
+ */
+ public String fill(Object tofill, int length){
+
+ String toFillTemp = null;
+
+ if(isNotNull(tofill)){
+ toFillTemp = tofill.toString();
+ }
+
+ return fill(toFillTemp, length);
+ }
+
+ /**
+ * @see org.jrimum.texgit.type#fill(org.jrimum.texgit.TextStream, int)
+ */
+ public String fill(TextStream tofill, int length){
+
+ String toFillTemp = null;
+
+ if(isNotNull(tofill)){
+ toFillTemp = tofill.write();
+ }
+
+ return fill(toFillTemp, length);
+ }
+
+ /**
+ * @param toFill
+ * @param length
+ * @return String preenchida
+ */
+ private String fillRight(String toFill, int length) {
+
+ return StringUtils.rightPad(toFill, length, padding.toString());
+ }
+
+ /**
+ * @param toFill
+ * @param length
+ * @return String preenchida
+ */
+ private String fillLeft(String toFill, int length) {
+
+ return StringUtils.leftPad(toFill, length, padding.toString());
+ }
+
+ @Override
+ public String toString() {
+
+ return format(
+ "Filler [padding=\"%s\", sideToFill=%s]"
+ , Objects.whenNull(this.padding, EMPTY)
+ , Objects.whenNull(this.sideToFill, EMPTY));
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Fillers.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Fillers.java
new file mode 100644
index 0000000..25ed6d9
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Fillers.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import org.jrimum.texgit.TextStream;
+import org.jrimum.utilix.text.Strings;
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+public enum Fillers implements org.jrimum.texgit.type.Filler{
+
+ /**
+ * Filler padrão para preenchimento com zeros a esquerda.
+ */
+ ZERO_LEFT(new Filler(0, Side.LEFT)),
+
+ /**
+ * Filler padrão para preenchimento com zeros a direita.
+ */
+ ZERO_RIGHT(new Filler(0, Side.RIGHT)),
+
+ /**
+ * Filler padrão para preenchimento com espaços em branco a esquerda.
+ */
+ WHITE_SPACE_LEFT(new Filler(Strings.WHITE_SPACE, Side.LEFT)),
+
+ /**
+ * Filler padrão para preenchimento com espaços em branco a direita.
+ */
+ WHITE_SPACE_RIGHT(new Filler(Strings.WHITE_SPACE, Side.RIGHT));
+
+ private Filler> filler;
+
+ private Fillers(Filler> filler){
+ this.filler = filler;
+ }
+
+ /**
+ * @param toFill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(java.lang.String, int)
+ */
+ public String fill(String toFill, int length) {
+ return filler.fill(toFill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(long, int)
+ */
+ public String fill(long tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(int, int)
+ */
+ public String fill(int tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(short, int)
+ */
+ public String fill(short tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(byte, int)
+ */
+ public String fill(byte tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(char, int)
+ */
+ public String fill(char tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(double, int)
+ */
+ public String fill(double tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(float, int)
+ */
+ public String fill(float tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(java.lang.Object, int)
+ */
+ public String fill(Object tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+ /**
+ * @param tofill
+ * @param length
+ * @return String preenchida
+ * @see org.jrimum.texgit.type.component.Filler#fill(org.jrimum.texgit.TextStream, int)
+ */
+ public String fill(TextStream tofill, int length) {
+ return filler.fill(tofill, length);
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FixedField.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FixedField.java
new file mode 100644
index 0000000..9674d7f
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FixedField.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.text.Format;
+
+import org.jrimum.texgit.type.Filler;
+import org.jrimum.utilix.Objects;
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+@SuppressWarnings("serial")
+public class FixedField extends Field implements org.jrimum.texgit.type.FixedField{
+
+ /**
+ *
+ * Tamanho de especificação e parâmetro da string de leitura ou escrita do campo.
+ *
+ */
+ private Integer length;
+
+ /**
+ *
+ * Preenchedor do valor utilizado na hora da escrita.
+ *
+ */
+ private Filler filler;
+
+
+ /**
+ *
+ * Tamanho da string de escrita do campo.
+ *
+ */
+ private Integer instantLength;
+
+ /**
+ *
+ * Ao ultrapassar o tamanho, define se pode truncar ou se dispara uma exceção.
+ *
+ */
+ private boolean truncate;
+
+
+ /**
+ *
+ */
+ public FixedField() {
+ super();
+ }
+
+ public FixedField(G value, Integer length) {
+ super(value);
+ setFixedLength(length);
+ }
+
+ public FixedField(G value, Integer length, Filler filler) {
+ super(value);
+ setFixedLength(length);
+ setFiller(filler);
+ }
+
+ public FixedField(G value, Integer length, Format formatter) {
+ super(value,formatter);
+ setFixedLength(length);
+ }
+
+ public FixedField(G value, Integer length, Format formatter, Filler filler) {
+ super(value,formatter);
+ setFixedLength(length);
+ setFiller(filler);
+ }
+
+ public FixedField(String name, G value, Integer length) {
+ super(name,value);
+ setFixedLength(length);
+ }
+
+ public FixedField(String name, G value, Integer length, Filler filler) {
+ super(name,value);
+ setFixedLength(length);
+ setFiller(filler);
+ }
+
+ public FixedField(String name, G value, Integer length, Format formatter) {
+ super(name,value,formatter);
+ setFixedLength(length);
+ }
+
+ public FixedField(String name, G value, Integer length, Format formatter, Filler filler) {
+ super(name,value,formatter);
+ setFixedLength(length);
+ setFiller(filler);
+ }
+
+ @Override
+ public FixedField clone() throws CloneNotSupportedException {
+
+ return (FixedField) super.clone();
+ }
+
+ /**
+ * @see org.jrimum.texgit.type.component.Field#read(java.lang.String)
+ */
+ @Override
+ public void read(String str) {
+
+ Objects.checkNotNull(str, "String inválida [null]!");
+
+ if (str.length() == getFixedLength()) {
+ super.read(str);
+ } else
+ throw new IllegalArgumentException(format("Tamanho da string [%s] diferente do especificado [%s]! %s",str.length(),getFixedLength(),toString()));
+ }
+
+ /**
+ * @see org.jrimum.texgit.type.component.Field#write()
+ */
+ @Override
+ public String write() {
+
+ String str = fill(super.write());
+
+ instantLength = str.length();
+
+ if (isTruncate() && instantLength > getFixedLength()) {
+ str = str.substring(0, getFixedLength());
+ instantLength = getFixedLength();
+ }
+
+ isFixedAsDefined();
+
+ return str;
+ }
+
+ private String fill(String str) {
+
+ if(isNotNull(filler))
+ str = filler.fill(str, length);
+
+ return str;
+ }
+
+ public boolean isFixedAsDefined() throws IllegalStateException {
+
+ if(instantLength.equals(getFixedLength()))
+ return true;
+ else
+ throw new IllegalStateException(format("Tamanho da string [%s] diferente do especificado [%s]! %s",instantLength,getFixedLength(),toString()));
+ }
+
+ public Integer getFixedLength() {
+
+ return this.length;
+ }
+
+ public void setFixedLength(Integer length) {
+
+ if (isNotNull(length) && length.intValue() > 0)
+ this.length = length;
+ else
+ throw new IllegalArgumentException(format("Comprimento inválido [%s]!",length));
+
+ }
+
+ public Filler getFiller() {
+ return filler;
+ }
+
+ public void setFiller(Filler filler) {
+
+ if(isNotNull(filler))
+ this.filler = filler;
+ else
+ throw new IllegalArgumentException(format("Preenchedor inválido [%s]!",filler));
+ }
+
+ public boolean isTruncate() {
+ return this.truncate;
+ }
+
+ public void setTruncate(boolean truncate) {
+ this.truncate = truncate;
+ }
+
+
+ @Override
+ public String toString() {
+
+ return format(
+ "%s FixedField [length=%s, instantLength=%s, filler=%s, truncate=%s]",
+ super.toString()
+ , Objects.whenNull(this.length, EMPTY)
+ , Objects.whenNull(this.instantLength, EMPTY)
+ , Objects.whenNull(this.filler, EMPTY)
+ , Objects.whenNull(this.truncate, EMPTY));
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FlatFile.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FlatFile.java
new file mode 100644
index 0000000..db110b6
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/FlatFile.java
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.jrimum.utilix.Objects.isNotNull;
+import static org.jrimum.utilix.Objects.isNull;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+@SuppressWarnings("serial")
+public class FlatFile implements org.jrimum.texgit.FlatFile{
+
+ private List records;
+
+ private Set repitablesRecords;
+
+ private List recordsOrder;
+
+ private RecordFactory recordFactory;
+
+ public FlatFile(RecordFactory iFac4Rec) {
+
+ this.recordFactory = iFac4Rec;
+ this.records = new ArrayList();
+ }
+
+ public Record getRecord(String idName){
+
+ Record record = null;
+
+ if (isNotBlank(idName)) {
+ if (!isRepitable(idName)){
+ if (!records.isEmpty()) {
+ for (Record rec : records) {
+ if (idName.equals(rec.getName()))
+ record = rec;
+ }
+ }
+ }
+ }
+
+ return record;
+ }
+
+ public boolean isRepitable(String idName){
+
+ return (isNotNull(repitablesRecords) && !repitablesRecords.isEmpty() && repitablesRecords.contains(idName));
+ }
+
+ public org.jrimum.texgit.Record createRecord(String idName){
+
+ return recordFactory.create(idName);
+ }
+
+ public void addRecord(Record record){
+
+ if(isNotNull(record))
+ if(isMyRecord(record.getName()))
+ records.add(record);
+ else
+ throw new IllegalArgumentException("Record fora de scopo!");
+ }
+
+ public boolean isMyRecord(String idName){
+ boolean is = false;
+
+ if (isNotBlank(idName)) {
+ if(!recordsOrder.isEmpty())
+ if(recordsOrder.contains(idName))
+ is = true;
+ }
+ return is;
+ }
+
+ public void read(List str) {
+
+ if(isNotNull(str)){
+ if(!str.isEmpty()){
+
+ String line = null;
+ int lineIndex = 0;
+
+ FixedField typeRecord = null;
+ Record record = null;
+
+ for(String id : recordsOrder){
+
+ record = recordFactory.create(id);
+
+ try{
+
+ if(isRepitable(id)){
+
+ boolean read = true;
+
+ while(read){
+
+ if(isNull(record))
+ record = recordFactory.create(id);
+
+ if(lineIndex < str.size())
+ line = str.get(lineIndex);
+
+ typeRecord = record.readID(line);
+
+ read = record.getIdType().getValue().equals(typeRecord.getValue()) && (lineIndex < str.size());
+
+ if(read){
+
+ record.read(line);
+ lineIndex++;
+ addRecord(record);
+
+ if(record.isHeadOfGroup()){
+ lineIndex = record.readInnerRecords(str,lineIndex,recordFactory);
+ }
+
+ record = null;
+ }
+ }
+
+ }else{
+ if((lineIndex < str.size())){
+
+ line = str.get(lineIndex);
+ typeRecord = record.readID(line);
+
+ if(record.getIdType().getValue().equals(typeRecord.getValue())){
+
+ record.read(line);
+ lineIndex++;
+ addRecord(record);
+
+ if(record.isHeadOfGroup()){
+ lineIndex = record.readInnerRecords(str,lineIndex,recordFactory);
+ }
+
+ record = null;
+ }
+ }
+ }
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar ler o registro \"%s\".", record.getName()), e);
+ }
+ }
+ }
+ }
+ }
+
+ public List write() {
+
+ return write(EMPTY);
+ }
+
+ public List write(String lineEnding) {
+
+ ArrayList out = new ArrayList(records.size());
+
+ for(String id : recordsOrder){
+
+ if(isRepitable(id)){
+
+ Record rec = null;
+
+ for(org.jrimum.texgit.Record record : getRecords(id)){
+
+ rec = Record.class.cast(record);
+
+ try{
+
+ out.add(rec.write()+lineEnding);
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar escrever o registro \"%s\".", rec.getName()), e);
+ }
+
+ if(rec.isHeadOfGroup() && rec.hasInnerRecords()){
+ out.addAll(rec.writeInnerRecords(lineEnding));
+ }
+ }
+
+ }else{
+
+ Record rec = getRecord(id);
+
+ try{
+
+ out.add(rec.write()+lineEnding);
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar escrever o registro \"%s\".", rec.getName()), e);
+ }
+
+ if(rec.isHeadOfGroup() && rec.hasInnerRecords()){
+ out.addAll(rec.writeInnerRecords(lineEnding));
+ }
+ }
+ }
+
+ return out;
+ }
+
+ public org.jrimum.texgit.FlatFile addRecord(org.jrimum.texgit.Record record) {
+
+ if(isNotNull(record)){
+ Record rec = Record.class.cast(record);
+ addRecord(rec);
+ }
+
+ return this;
+ }
+
+ public Collection getRecords(String idName) {
+
+ List secRecords = new ArrayList();
+
+ if (isNotBlank(idName)) {
+ if (isRepitable(idName)) {
+ if (!records.isEmpty()) {
+ for (Record rec : records) {
+ if (idName.equals(rec.getName()))
+ secRecords.add(rec);
+ }
+ }
+ }
+ }
+
+ return secRecords;
+ }
+
+ public org.jrimum.texgit.FlatFile addAllRecords(Collection records) {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public org.jrimum.texgit.FlatFile addRecords(String idName, Collection records) {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public Collection getAllRecords() {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public org.jrimum.texgit.Record removeRecord(String idName) {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public org.jrimum.texgit.FlatFile setAllRecords(Collection records) {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public org.jrimum.texgit.FlatFile setRecords(String idName, Collection records) {
+ // TODO IMPLEMENTAR
+ throw new UnsupportedOperationException("AINDA NÃO IMPLEMENTADO!");
+ }
+
+ public Set getRepitablesRecords() {
+ return repitablesRecords;
+ }
+
+ public void setRepitablesRecords(Set repitablesRecords) {
+ this.repitablesRecords = repitablesRecords;
+ }
+
+ public List getRecordsOrder() {
+ return recordsOrder;
+ }
+
+ public void setRecordsOrder(List recordsOrder) {
+ this.recordsOrder = recordsOrder;
+ }
+
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Record.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Record.java
new file mode 100644
index 0000000..441699d
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Record.java
@@ -0,0 +1,446 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import static java.lang.String.format;
+import static org.apache.commons.lang.StringUtils.EMPTY;
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.jrimum.utilix.Objects.isNotNull;
+import static org.jrimum.utilix.Objects.isNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jrimum.texgit.type.Field;
+import org.jrimum.utilix.Objects;
+
+
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ */
+@SuppressWarnings("serial")
+public class Record extends BlockOfFields implements org.jrimum.texgit.Record{
+
+ private String name;
+
+ private String description;
+
+ private FixedField idType;
+
+ private FixedField sequencialNumber;
+
+ private boolean headOfGroup;
+
+ private List innerRecords;
+
+ private Set repitablesRecords;
+
+ private List declaredInnerRecords;
+
+ public Record() {
+ super();
+ }
+
+ /**
+ * @param length
+ * @param size
+ */
+ public Record(Integer length, Integer size) {
+ super(length, size);
+ }
+
+ @Override
+ public Record clone() throws CloneNotSupportedException {
+ //TODO Outros atributos
+ return (Record) super.clone();
+ }
+
+ @SuppressWarnings("null")
+ public FixedField readID(String lineRecord) {
+
+ FixedField ffID = null;
+
+ try {
+
+ ffID = getIdType().clone();
+ ffID.setName("");
+
+ } catch (CloneNotSupportedException e) {
+
+ throw new UnsupportedOperationException(format("Quebra de contrato [%s] não suporta clonagem!",Objects.whenNull(ffID, "FixedField", ffID.getClass())), e);
+ }
+
+ getIdType().read(lineRecord.substring(getIdPosition(), getIdPosition() + getIdType().getFixedLength()));
+
+ return ffID;
+ }
+
+ public org.jrimum.texgit.type.FixedField> getField(String fieldName) {
+
+ org.jrimum.texgit.type.FixedField> field = null;
+
+ if (isNotBlank(fieldName))
+ if (!getFields().isEmpty())
+ for (FixedField> ff : this.getFields())
+ if (ff.getName().equals(fieldName)) {
+ field = ff;
+ break;
+ }
+
+ return field;
+ }
+
+ public boolean isMyField(String idName){
+ boolean is = false;
+
+ if (isNotBlank(idName)) {
+ if(!getFields().isEmpty())
+ for(org.jrimum.texgit.type.Field> f : getFields())
+ if(idName.equals(f.getName())){
+ is = true;
+ break;
+ }
+ }
+ return is;
+ }
+
+ private int getIdPosition(){
+ int pos = 0;
+
+ for(FixedField> ff : this.getFields())
+ if(!ff.getName().equals(idType.getName()))
+ pos += ff.getFixedLength();
+ else
+ break;
+
+ return pos;
+ }
+
+ public int readInnerRecords(List lines, int lineIndex, RecordFactory iFactory) {
+
+ return readInnerRecords(this,lines,lineIndex,iFactory);
+ }
+
+ private int readInnerRecords(Record record, List lines, int lineIndex, RecordFactory iFactory) {
+
+ if(isNotNull(record)){
+
+ if(isNotNull(record.getDeclaredInnerRecords()) && !record.getDeclaredInnerRecords().isEmpty()){
+
+ boolean read = true;
+ String line = null;
+
+ FixedField typeRecord = null;
+ Record innerRec = null;
+
+ for(String id : record.getDeclaredInnerRecords()){
+
+ innerRec = iFactory.create(id);
+
+ try{
+
+ if(isRepitable(id)){
+
+ while(read){
+
+ if(isNull(innerRec))
+ innerRec = iFactory.create(id);
+
+ if(lineIndex < lines.size())
+ line = lines.get(lineIndex);
+
+ typeRecord = innerRec.readID(line);
+
+ read = innerRec.getIdType().getValue().equals(typeRecord.getValue()) && (lineIndex < lines.size());
+
+ if(read){
+
+ innerRec.read(line);
+ lineIndex++;
+ record.addInnerRecord(innerRec);
+
+ if(innerRec.isHeadOfGroup())
+ innerRec.readInnerRecords(lines,lineIndex,iFactory);
+
+ innerRec = null;
+ }
+ }
+
+ }else{
+ if((lineIndex < lines.size())){
+
+ line = lines.get(lineIndex);
+ typeRecord = innerRec.readID(line);
+
+ if(innerRec.getIdType().getValue().equals(typeRecord.getValue())){
+
+ innerRec.read(line);
+ lineIndex++;
+ record.addInnerRecord(innerRec);
+
+ if(innerRec.isHeadOfGroup())
+ innerRec.readInnerRecords(lines,lineIndex,iFactory);
+
+ innerRec = null;
+ }
+ }
+ }
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar ler o registro \"%s\".",
+ innerRec.getName()), e);
+ }
+ }
+ }
+ }
+
+ return lineIndex;
+ }
+
+ public List writeInnerRecords(){
+
+ return writeInnerRecords(this,EMPTY);
+ }
+
+ public List writeInnerRecords(String lineEnding){
+
+ return writeInnerRecords(this,lineEnding);
+ }
+
+ private List writeInnerRecords(Record record, String lineEnding){
+
+ ArrayList out = new ArrayList(record.getInnerRecords().size());
+
+ for(String id : getDeclaredInnerRecords()){//ordem
+
+ if(isRepitable(id)){
+
+ for(Record rec : getRecords(id)){
+
+ try{
+
+ out.add(rec.write()+lineEnding);
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar escrever o registro \"%s\".", rec.getName()), e);
+ }
+
+ if(rec.isHeadOfGroup())
+ out.addAll(rec.writeInnerRecords());
+ }
+
+ }else{
+
+ Record rec = getRecord(id);
+
+ try{
+
+ out.add(rec.write()+lineEnding);
+
+ } catch (Exception e) {
+
+ throw new IllegalStateException(format(
+ "Erro ao tentar escrever o registro \"%s\".", rec.getName()), e);
+ }
+
+ if(rec.isHeadOfGroup())
+ out.addAll(rec.writeInnerRecords());
+ }
+ }
+
+ return out;
+ }
+
+ public Record getRecord(String idName){
+
+ Record record = null;
+
+ if (isNotBlank(idName)) {
+ if (!isRepitable(idName)){
+ if (!getInnerRecords().isEmpty()) {
+ for (org.jrimum.texgit.Record iRec : getInnerRecords()) {
+ Record rec = (Record) iRec;
+ if (idName.equals(rec.getName()))
+ record = rec;
+ }
+ }
+ }
+ }
+
+ return record;
+ }
+
+ public List getRecords(String idName) {
+
+ List secRecords = new ArrayList();
+
+ if (isNotBlank(idName)) {
+ if (isRepitable(idName)) {
+ if (!getInnerRecords().isEmpty()) {
+ for (org.jrimum.texgit.Record iRec : getInnerRecords()) {
+ Record rec = (Record) iRec;
+ if (idName.equals(rec.getName()))
+ secRecords.add(rec);
+ }
+ }
+ }
+ }
+
+ return secRecords;
+ }
+
+ public boolean isRepitable(String idName){
+
+ return (isNotNull(repitablesRecords) && !repitablesRecords.isEmpty() && repitablesRecords.contains(idName));
+ }
+
+ public boolean isMyRecord(String idName){
+ boolean is = false;
+
+ if (isNotBlank(idName)) {
+ if(!getDeclaredInnerRecords().isEmpty())
+ if(getDeclaredInnerRecords().contains(idName))
+ is = true;
+ }
+ return is;
+ }
+
+ public org.jrimum.texgit.Record addInnerRecord(org.jrimum.texgit.Record record) {
+
+ if(isNotNull(record)){
+ if(isNull(this.innerRecords))
+ this.innerRecords = new ArrayList();
+
+ if(isMyRecord(Record.class.cast(record).getName()))
+ this.innerRecords.add(record);
+ else
+ throw new IllegalArgumentException("Record fora de scopo!");
+
+ }
+
+ return this;
+ }
+
+ public List getInnerRecords() {
+
+ return this.innerRecords;
+ }
+
+ @SuppressWarnings("unchecked")
+ public G getValue(String fieldName) {
+
+ G value = null;
+
+ org.jrimum.texgit.type.Field> f = getField(fieldName);
+
+ if(isNotNull(f))
+ value = (G) f.getValue();
+
+ return value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public org.jrimum.texgit.Record setValue(String fieldName, G value) {
+
+ org.jrimum.texgit.type.Field f = (Field) getField(fieldName);
+
+ if(isNotNull(f))
+ f.setValue(value);
+
+ return this;
+ }
+
+ public boolean hasInnerRecords(){
+ return getInnerRecords() != null && !getInnerRecords().isEmpty();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public FixedField getIdType() {
+ return idType;
+ }
+
+ public void setIdType(FixedField idType) {
+ this.idType = idType;
+ }
+
+ public FixedField getSequencialNumber() {
+ return sequencialNumber;
+ }
+
+ public void setSequencialNumber(FixedField sequencialNumber) {
+ this.sequencialNumber = sequencialNumber;
+ }
+
+ public boolean isHeadOfGroup() {
+ return headOfGroup;
+ }
+
+ public void setHeadOfGroup(boolean headOfGroup) {
+ this.headOfGroup = headOfGroup;
+ }
+
+ public List getDeclaredInnerRecords() {
+ return declaredInnerRecords;
+ }
+
+ public void setDeclaredInnerRecords(List declaredInnerRecords) {
+ this.declaredInnerRecords = declaredInnerRecords;
+ }
+
+ public Set getRepitablesRecords() {
+ return repitablesRecords;
+ }
+
+ public void setRepitablesRecords(Set repitablesRecords) {
+ this.repitablesRecords = repitablesRecords;
+ }
+
+}
\ No newline at end of file
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/RecordFactory.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/RecordFactory.java
new file mode 100644
index 0000000..58ebe6e
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/RecordFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 26/07/2008 - 12:44:41
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 26/07/2008 - 12:44:41
+ *
+ */
+package org.jrimum.texgit.type.component;
+
+import org.jrimum.texgit.Record;
+
+/**
+ * @author Gilmar P.S.L.
+ *
+ * @param
+ */
+public interface RecordFactory {
+
+ public abstract G create(String name);
+}
diff --git a/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Side.java b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Side.java
new file mode 100644
index 0000000..b6ed52e
--- /dev/null
+++ b/jrimum-texgit/src/main/java/org/jrimum/texgit/type/component/Side.java
@@ -0,0 +1,13 @@
+package org.jrimum.texgit.type.component;
+
+/**
+ * Lados para alinhar campos, preenchimento ou orientações em geral.
+ *
+ * @author Gilmar P.S.L.
+ */
+public enum Side {
+
+ LEFT,
+
+ RIGHT;
+}
diff --git a/jrimum-texgit/src/main/resources/TexgitSchema.xsd b/jrimum-texgit/src/main/resources/TexgitSchema.xsd
new file mode 100644
index 0000000..3185161
--- /dev/null
+++ b/jrimum-texgit/src/main/resources/TexgitSchema.xsd
@@ -0,0 +1,537 @@
+
+
+
+
+
+
+
+
+ Representação de classes e atributos usados para definição
+ da linguagem Texgit.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Elemento root.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Versão Da Linguagem Textgit
+
+
+
+
+
+
+
+
+
+
+
+ Flat File é um tipo de arquivo texto com informações estruturadas
+ com base em formatações e estruturas pré definidas. veja mais em (link).
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tags para informar o layout do flafile definido.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Conjunto de records de um flatfile ou relacionados a um outro record.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Uma espécie de container de fields numa forma mais simples, usualmente é conhecido como
+ Registro ou Bloco.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Agregado de fields.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Identificação para um tipo de Record.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Field para sequenciamento do de um Record.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Field é a unidade básica de informação de um registro, um field está para
+ um registro assim como uma coluna de banco de dados está para uma tabela.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Para definição da posição.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Instrumento utilizado para preencher um field com um formato e caracteres
+ pré definidos.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Formato utilizado por um Filler (Preenchedor).
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Versão da linguagem utilizada para descricação de flat
+ files.
+
+ Padrão: "d.d ou d.d-'tag' ou d.d-'tag'd" Exemplo: 1.4 ou
+ 1.23-beta ou 1.23-beta5
+
+
+
+
+
+
+
+
+
+
+
+
+ Tipificação e regras para campos strings utilizados como
+ identificadores. Padarão: letras,dígitos, traços (-) ou
+ underlines (_).
+
+
+
+
+
+
+
+
+
+
+
+
+ Tipificação e regras para descrição de campos strings.
+
+
+
+
+
+
+
+
+
+
+ Tipificação e regras para campos interios usados como
+ represenações de quantidade
+
+
+
+
+
+
+
+
+
+
+ Tipificação e regras para campos strings utilizados como
+ definições de formatos.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Formatos pré definidos suportados pelo
+ componente.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tipo de formatadores suportados. Usados junto a
+ definição de novos formatadores.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Preenchimentos suportados por padrão pelo
+ componente.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Basicamente são definições de direções de
+ escrita e leitura.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tipos usados para obtenção dos campos de texto
+ para java. No caso representa os tipos java
+ possíveis para um campo.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFiller.java b/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFiller.java
new file mode 100644
index 0000000..05aef8a
--- /dev/null
+++ b/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFiller.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:15:42
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:15:42
+ *
+ */
+
+package org.jrimum.texgit.type.component;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.jrimum.texgit.TextStream;
+import org.jrimum.texgit.type.component.Filler;
+import org.jrimum.utilix.text.Strings;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * Teste unitário para a classe Filler.
+ *
+ *
+ * @author Gilmar P.S.L.
+ * @author Rômulo Augusto
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public class TestFiller {
+
+ private static final String CAMPO = "TESTE";
+
+ private static final int TAMANHO = 10;
+
+ private Filler fillerString;
+ private Filler fillerInteger;
+ private Filler fillerDouble;
+ private Filler fillerSide;
+ private Filler whiteSpaceLeft;
+ private Filler zeroLeft ;
+ private Filler zeroRight;
+
+ @Before
+ public void setup(){
+ whiteSpaceLeft = new Filler(Strings.WHITE_SPACE, Side.LEFT);
+ zeroLeft = new Filler(0, Side.LEFT);
+ zeroRight = new Filler(0, Side.RIGHT);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetSideNullValue() {
+
+ whiteSpaceLeft.setSideToFill(null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetToFillNullValue() {
+
+ whiteSpaceLeft.setPadding(null);
+ }
+
+ @Test
+ public void testSetToFill() {
+
+ whiteSpaceLeft.setPadding(CAMPO);
+
+ assertTrue(whiteSpaceLeft.getPadding() instanceof String);
+ assertEquals(whiteSpaceLeft.getPadding(), CAMPO);
+ }
+
+ @Test
+ public void testSetSide() {
+
+ whiteSpaceLeft.setSideToFill(Side.RIGHT);
+
+ assertEquals(whiteSpaceLeft.getSideToFill(), Side.RIGHT);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testFiller() {
+
+ new Filler(null, null);
+ new Filler("", null);
+ new Filler(null, Side.LEFT);
+ }
+
+ @Test
+ public void testFillString() {
+
+ assertEquals(CAMPO + "00000", zeroRight.fill(CAMPO, TAMANHO));
+ assertEquals("00000" + CAMPO, zeroLeft.fill(CAMPO, TAMANHO));
+ }
+
+ @Test
+ public void testFillLong() {
+
+ assertEquals(1L + "000000000", zeroRight.fill(1L, TAMANHO));
+ assertEquals("000000000" + 1L, zeroLeft.fill(1L, TAMANHO));
+ }
+
+ @Test
+ public void testFillInt() {
+
+ assertEquals(1 + "000000000", zeroRight.fill(1, TAMANHO));
+ assertEquals("000000000" + 1, zeroLeft.fill(1, TAMANHO));
+ }
+
+ @Test
+ public void testFillShort() {
+
+ assertEquals((short) 1 + "000000000", zeroRight.fill((short) 1,
+ TAMANHO));
+ assertEquals("000000000" + (short) 1, zeroLeft.fill((short) 1,
+ TAMANHO));
+ }
+
+ @Test
+ public void testFillByte() {
+
+ assertEquals((byte) 1 + "000000000", zeroRight.fill((byte) 1,
+ TAMANHO));
+ assertEquals("000000000" + (byte) 1, zeroLeft.fill((byte) 1,
+ TAMANHO));
+ }
+
+ @Test
+ public void testFillChar() {
+
+ assertEquals('1' + "000000000", zeroRight.fill('1', TAMANHO));
+ assertEquals("000000000" + '1', zeroLeft.fill('1', TAMANHO));
+ }
+
+ @Test
+ public void testFillDouble() {
+
+ assertEquals(1.0 + "0000000", zeroRight.fill(1.0, TAMANHO));
+ assertEquals("0000000" + 1.0, zeroLeft.fill(1.0, TAMANHO));
+ }
+
+ @Test
+ public void testFillFloat() {
+
+ assertEquals(1.0f + "0000000", zeroRight.fill(1.0f, TAMANHO));
+ assertEquals("0000000" + 1.0f, zeroLeft.fill(1.0f, TAMANHO));
+ }
+
+ @Test
+ public void testFillObject() {
+
+ Object object = new Object() {
+
+ @Override
+ public String toString() {
+ return CAMPO;
+ }
+ };
+
+ assertEquals(object + "00000", zeroRight.fill(object, TAMANHO));
+ assertEquals("00000" + object, zeroLeft.fill(object, TAMANHO));
+ }
+
+ @Test
+ public void testFillITextStream() {
+
+ TextStream textStream = new TextStream() {
+
+ private static final long serialVersionUID = 1L;
+
+ public void read(String g) {
+ }
+
+ public String write() {
+
+ return CAMPO;
+ }
+ };
+
+ assertEquals(textStream.write() + "00000", zeroRight.fill(
+ textStream, TAMANHO));
+ assertEquals("00000" + textStream.write(), zeroLeft.fill(
+ textStream, TAMANHO));
+ }
+
+ @Test
+ public void testFill() {
+
+ fillerString = new Filler("ABC", Side.LEFT);
+ assertTrue(fillerString.getPadding() instanceof String);
+ assertEquals("ABCAB" + CAMPO, fillerString.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerString.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerString.fill(CAMPO, -TAMANHO));
+
+ fillerString.setSideToFill(Side.RIGHT);
+ assertEquals(CAMPO + "ABCAB", fillerString.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerString.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerString.fill(CAMPO, -TAMANHO));
+
+ fillerInteger = new Filler(new Integer(TAMANHO),
+ Side.LEFT);
+ assertTrue(fillerInteger.getPadding() instanceof Integer);
+ assertEquals("10101" + CAMPO, fillerInteger.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerInteger.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerInteger.fill(CAMPO, -TAMANHO));
+
+ fillerInteger.setSideToFill(Side.RIGHT);
+ assertEquals(CAMPO + "10101", fillerInteger.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerInteger.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerInteger.fill(CAMPO, -TAMANHO));
+
+ fillerDouble = new Filler(new Double(10.9), Side.LEFT);
+ assertTrue(fillerDouble.getPadding() instanceof Double);
+ assertEquals("10.91" + CAMPO, fillerDouble.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerDouble.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerDouble.fill(CAMPO, -TAMANHO));
+
+ fillerDouble.setSideToFill(Side.RIGHT);
+ assertEquals(CAMPO + "10.91", fillerDouble.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerDouble.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerDouble.fill(CAMPO, -TAMANHO));
+
+ fillerSide = new Filler(Side.LEFT, Side.LEFT);
+ assertTrue(fillerSide.getPadding() instanceof Side);
+ assertEquals("LEFTL" + CAMPO, fillerSide.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerSide.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerSide.fill(CAMPO, -TAMANHO));
+
+ fillerSide.setSideToFill(Side.RIGHT);
+ assertEquals(CAMPO + "LEFTL", fillerSide.fill(CAMPO, TAMANHO));
+ assertEquals(CAMPO, fillerSide.fill(CAMPO, 0));
+ assertEquals(CAMPO, fillerSide.fill(CAMPO, -TAMANHO));
+ }
+
+}
diff --git a/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFixedField.java b/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFixedField.java
new file mode 100644
index 0000000..1422a8d
--- /dev/null
+++ b/jrimum-texgit/src/test/java/org/jrimum/texgit/type/component/TestFixedField.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:15:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:15:56
+ *
+ */
+
+package org.jrimum.texgit.type.component;
+
+import static org.jrimum.utilix.text.DateFormat.DDMMYYYY_B;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.Format;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.commons.lang.StringUtils;
+import org.jrimum.utilix.Dates;
+import org.jrimum.utilix.text.DecimalFormat;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * Teste unitário para a classe utilitária de coleções.
+ *
+ *
+ * @author Gilmar P.S.L.
+ * @author Rômulo Augusto
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public class TestFixedField {
+
+ private static final DateFormat FORMAT_DDMMYY = new SimpleDateFormat("ddMMyy");
+
+ private FixedField campoString;
+
+ private FixedField campoInteger;
+
+ private FixedField campoLong;
+
+ private FixedField campoDate;
+
+ private FixedField campoDecimal;
+
+ private FixedField campoDecimal_v9;
+
+ @Before
+ public void setUp() {
+
+ campoString = new FixedField(StringUtils.EMPTY, 8, Fillers.WHITE_SPACE_RIGHT);
+
+ campoDate = new FixedField(DDMMYYYY_B.parse("22/07/2007"), 6, FORMAT_DDMMYY);
+
+ campoInteger = new FixedField(0, 6, Fillers.ZERO_LEFT);
+
+ campoLong = new FixedField(0L, 6, Fillers.ZERO_LEFT);
+
+ campoDecimal = new FixedField(new BigDecimal("875.98"), 11, DecimalFormat.NUMBER_DD_BR.copy(), Fillers.ZERO_LEFT);
+
+ campoDecimal_v9 = new FixedField(new BigDecimal("875.9"), 10, DecimalFormat.NUMBER_D_BR.copy(), Fillers.ZERO_LEFT);
+ }
+
+ @After
+ public void tearDown() {
+
+ campoString = null;
+ campoDate = null;
+ campoInteger = null;
+ campoLong = null;
+ campoDecimal = null;
+ campoDecimal_v9 = null;
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testCampo() {
+
+ Format format = null;
+
+ campoDate = new FixedField(new Date(), 0, FORMAT_DDMMYY);
+ campoDate = new FixedField(null, 1, FORMAT_DDMMYY);
+ campoDate = new FixedField(new Date(), 0, format);
+ }
+
+ @Test
+ public void testLer() {
+
+ campoString.read("COBRANCA");
+ assertNotNull(campoString.getValue());
+ assertTrue(campoString.getValue() instanceof String);
+ assertEquals("COBRANCA", campoString.getValue().toString());
+
+ campoDate.read("011002");
+ assertNotNull(campoDate.getValue());
+ assertTrue(campoDate.getValue() instanceof Date);
+ assertEquals("011002", FORMAT_DDMMYY.format(campoDate
+ .getValue()));
+
+ campoInteger.read("000001");
+ assertNotNull(campoInteger.getValue());
+ assertTrue(campoInteger.getValue() instanceof Integer);
+ assertTrue(new Integer(1).compareTo(campoInteger.getValue()) == 0);
+
+ campoLong.read("000001");
+ assertNotNull(campoLong.getValue());
+ assertTrue(campoLong.getValue() instanceof Long);
+ assertTrue(new Long(1L).compareTo(campoLong.getValue()) == 0);
+
+ campoDecimal.read("00000087598");
+ assertNotNull(campoDecimal.getValue());
+ assertTrue(campoDecimal.getValue() instanceof BigDecimal);
+ assertTrue(new BigDecimal("875.98").compareTo(campoDecimal.getValue()) == 0);
+
+ campoDecimal_v9.read("0000008759");
+ assertNotNull(campoDecimal_v9.getValue());
+ assertTrue(campoDecimal_v9.getValue() instanceof BigDecimal);
+ assertTrue(new BigDecimal("875.9").compareTo(campoDecimal_v9
+ .getValue()) == 0);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLerException() {
+
+ campoString.read(null);
+ campoDate.read(null);
+ campoDate.read("");
+ campoDate.read("abcd");
+ campoDate.read("1a2MA1205");
+ }
+
+ @Test
+ public void testEscrever() {
+
+ assertNotNull(campoString.write());
+ assertEquals(" ", campoString.write());
+ assertEquals(8, campoString.write().length());
+
+ assertNotNull(campoDate.write());
+ assertEquals("220707", campoDate.write());
+ assertEquals(6, campoDate.write().length());
+
+ campoDate.setValue(Dates.invalidDate());
+ campoDate.setFiller(Fillers.ZERO_LEFT);
+ assertNotNull(campoDate.write());
+ assertEquals("000000", campoDate.write());
+ assertEquals(6, campoDate.write().length());
+
+ assertNotNull(campoInteger.write());
+ assertEquals("000000", campoInteger.write());
+ assertEquals(6, campoInteger.write().length());
+
+ assertNotNull(campoLong.write());
+ assertEquals("000000", campoLong.write());
+ assertEquals(6, campoLong.write().length());
+
+ assertNotNull(campoDecimal.write());
+ assertEquals("00000087598", campoDecimal.write());
+ assertEquals(11, campoDecimal.write().length());
+
+ assertNotNull(campoDecimal_v9.write());
+ assertEquals("0000008759", campoDecimal_v9.write());
+ assertEquals(10, campoDecimal_v9.write().length());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testEscreverException() {
+
+ FixedField campo = new FixedField("tamanho", 5);
+ assertEquals(5, campo.write().length());
+
+ FixedField campo1 = new FixedField(1234, 3);
+ assertEquals(3, campo1.write().length());
+
+ FixedField campo2 = new FixedField(12, 3);
+ assertEquals(3, campo2.write().length());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetCampo() {
+ campoInteger.setValue(null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetTamanhoZero() {
+ campoString.setFixedLength(0);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetTamanhoNegativo() {
+ campoString.setFixedLength(-1);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetFiller() {
+ campoString.setFiller(null);
+ }
+
+}
diff --git a/jrimum-texgit/src/test/java/org/jrimum/utilix/excludes/TestUtil.java b/jrimum-texgit/src/test/java/org/jrimum/utilix/excludes/TestUtil.java
new file mode 100644
index 0000000..d848653
--- /dev/null
+++ b/jrimum-texgit/src/test/java/org/jrimum/utilix/excludes/TestUtil.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 JRimum Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ * applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * Created at: 30/03/2008 - 18:15:56
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2008 JRimum Project
+ *
+ * Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
+ * esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
+ * cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
+ * haja exigência legal ou acordo por escrito, a distribuição de software sob
+ * esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
+ * TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
+ * reger permissões e limitações sob esta LICENÇA.
+ *
+ * Criado em: 30/03/2008 - 18:15:56
+ *
+ */
+package org.jrimum.utilix.excludes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+
+import org.jrimum.texgit.type.FixedField;
+import org.jrimum.texgit.type.component.Field;
+
+/**
+ *