From 8dcb49d9d97a4bbd77faa40d1d7cbb1ec781fc07 Mon Sep 17 00:00:00 2001
From: fabiorj
Date: Sat, 4 Dec 2021 12:21:20 -0300
Subject: [PATCH] commit inicial
---
jrimum-utilix/.gitignore | 6 +
jrimum-utilix/CHANGELOG.md | 9 +
jrimum-utilix/LICENSE | 191 +++++++
jrimum-utilix/README.md | 6 +
jrimum-utilix/pom.xml | 193 +++++++
.../main/java/org/jrimum/utilix/Arrays.java | 412 ++++++++++++++
.../java/org/jrimum/utilix/ClassLoaders.java | 175 ++++++
.../java/org/jrimum/utilix/Collections.java | 512 +++++++++++++++++
.../main/java/org/jrimum/utilix/Dates.java | 253 +++++++++
.../java/org/jrimum/utilix/Exceptions.java | 251 +++++++++
.../main/java/org/jrimum/utilix/Locales.java | 64 +++
.../main/java/org/jrimum/utilix/Objects.java | 362 ++++++++++++
.../java/org/jrimum/utilix/package-info.java | 35 ++
.../org/jrimum/utilix/text/DateFormat.java | 247 +++++++++
.../org/jrimum/utilix/text/DecimalFormat.java | 129 +++++
.../utilix/text/DecimalFormatSymbols.java | 93 ++++
.../java/org/jrimum/utilix/text/Format.java | 76 +++
.../java/org/jrimum/utilix/text/Strings.java | 516 +++++++++++++++++
.../jrimum/utilix/text/ThreadLocalFormat.java | 55 ++
.../text/ThreadLocalLocalizedFormat.java | 84 +++
.../org/jrimum/utilix/text/package-info.java | 35 ++
.../org/jrimum/utilix/TestCollections.java | 230 ++++++++
.../java/org/jrimum/utilix/TestDates.java | 161 ++++++
.../java/org/jrimum/utilix/TestObjects.java | 133 +++++
.../org/jrimum/utilix/text/TestStrings.java | 172 ++++++
jrimum-vallia/.gitignore | 6 +
jrimum-vallia/CHANGELOG.md | 6 +
jrimum-vallia/LICENSE | 191 +++++++
jrimum-vallia/README.md | 6 +
jrimum-vallia/pom.xml | 182 ++++++
.../jrimum-vallia-with-dependencies.xml | 22 +
.../jrimum/vallia/AbstractCPRFValidator.java | 344 ++++++++++++
.../java/org/jrimum/vallia/CNPJValidator.java | 100 ++++
.../java/org/jrimum/vallia/CPFValidator.java | 99 ++++
.../AbstractDigitoVerificador.java | 86 +++
.../BoletoCodigoDeBarrasDV.java | 108 ++++
.../BoletoLinhaDigitavelDV.java | 138 +++++
.../vallia/digitoverificador/CNPJDV.java | 231 ++++++++
.../vallia/digitoverificador/CPFDV.java | 223 ++++++++
.../CodigoDeCompensacaoBancosBACENDV.java | 194 +++++++
.../vallia/digitoverificador/Modulo.java | 518 ++++++++++++++++++
.../digitoverificador/TipoDeModulo.java | 83 +++
.../digitoverificador/package-info.java | 35 ++
.../java/org/jrimum/vallia/package-info.java | 35 ++
.../vallia/TestAbstractCPRFValidator.java | 140 +++++
.../org/jrimum/vallia/TestCNPJValidator.java | 67 +++
.../org/jrimum/vallia/TestCPFValidator.java | 67 +++
.../TestBoletoCodigoDeBarrasDV.java | 83 +++
.../TestBoletoLinhaDigitavelDV.java | 105 ++++
.../vallia/digitoverificador/TestCNPJDV.java | 101 ++++
.../vallia/digitoverificador/TestCPFDV.java | 100 ++++
.../TestCodigoDeCompensacaoBancosBACENDV.java | 211 +++++++
.../vallia/digitoverificador/TestModulo.java | 127 +++++
.../digitoverificador/TestTipoDeModulo.java | 54 ++
54 files changed, 8062 insertions(+)
create mode 100644 jrimum-utilix/.gitignore
create mode 100644 jrimum-utilix/CHANGELOG.md
create mode 100644 jrimum-utilix/LICENSE
create mode 100644 jrimum-utilix/README.md
create mode 100644 jrimum-utilix/pom.xml
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Arrays.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/ClassLoaders.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Collections.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Dates.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Exceptions.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Locales.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/Objects.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/package-info.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/DateFormat.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormat.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormatSymbols.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/Format.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/Strings.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalFormat.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalLocalizedFormat.java
create mode 100644 jrimum-utilix/src/main/java/org/jrimum/utilix/text/package-info.java
create mode 100644 jrimum-utilix/src/test/java/org/jrimum/utilix/TestCollections.java
create mode 100644 jrimum-utilix/src/test/java/org/jrimum/utilix/TestDates.java
create mode 100644 jrimum-utilix/src/test/java/org/jrimum/utilix/TestObjects.java
create mode 100644 jrimum-utilix/src/test/java/org/jrimum/utilix/text/TestStrings.java
create mode 100644 jrimum-vallia/.gitignore
create mode 100644 jrimum-vallia/CHANGELOG.md
create mode 100644 jrimum-vallia/LICENSE
create mode 100644 jrimum-vallia/README.md
create mode 100644 jrimum-vallia/pom.xml
create mode 100644 jrimum-vallia/src/main/assembly/jrimum-vallia-with-dependencies.xml
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/AbstractCPRFValidator.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/CNPJValidator.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/CPFValidator.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/AbstractDigitoVerificador.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/BoletoCodigoDeBarrasDV.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/BoletoLinhaDigitavelDV.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/CNPJDV.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/CPFDV.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/CodigoDeCompensacaoBancosBACENDV.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/Modulo.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/TipoDeModulo.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/digitoverificador/package-info.java
create mode 100644 jrimum-vallia/src/main/java/org/jrimum/vallia/package-info.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/TestAbstractCPRFValidator.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/TestCNPJValidator.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/TestCPFValidator.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestBoletoCodigoDeBarrasDV.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestBoletoLinhaDigitavelDV.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestCNPJDV.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestCPFDV.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestCodigoDeCompensacaoBancosBACENDV.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestModulo.java
create mode 100644 jrimum-vallia/src/test/java/org/jrimum/vallia/digitoverificador/TestTipoDeModulo.java
diff --git a/jrimum-utilix/.gitignore b/jrimum-utilix/.gitignore
new file mode 100644
index 0000000..b52163d
--- /dev/null
+++ b/jrimum-utilix/.gitignore
@@ -0,0 +1,6 @@
+/bin
+/target
+.classpath
+.DS_Store
+.project
+.settings
diff --git a/jrimum-utilix/CHANGELOG.md b/jrimum-utilix/CHANGELOG.md
new file mode 100644
index 0000000..255285e
--- /dev/null
+++ b/jrimum-utilix/CHANGELOG.md
@@ -0,0 +1,9 @@
+Utilix Changelog
+=============================
+
+0.2.3 (2014/02/01) suport bopepo-0.2.3
+---------------------------------------
+
+**Improvement**
+
+ * #2: Remover classes relacionadas a LineOfFields
\ No newline at end of file
diff --git a/jrimum-utilix/LICENSE b/jrimum-utilix/LICENSE
new file mode 100644
index 0000000..37ec93a
--- /dev/null
+++ b/jrimum-utilix/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-utilix/README.md b/jrimum-utilix/README.md
new file mode 100644
index 0000000..33f040e
--- /dev/null
+++ b/jrimum-utilix/README.md
@@ -0,0 +1,6 @@
+Utilix
+======
+
+Utilitários usados no projeto [Lançado embutido, incubado]
+
+[](https://ci-jrimum.rhcloud.com)
diff --git a/jrimum-utilix/pom.xml b/jrimum-utilix/pom.xml
new file mode 100644
index 0000000..371ca0f
--- /dev/null
+++ b/jrimum-utilix/pom.xml
@@ -0,0 +1,193 @@
+
+
+ 4.0.0
+ br.com.rjconsultores
+ jrimum-utilix
+ jar
+ Projeto Utilix
+ 1.0.0
+ Projeto open source de componentes de software para o domínio de negócios do Brasil.
+ http://www.jrimum.org/utilix
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ Projeto JRimum
+ http://www.jrimum.org
+
+
+
+ GitHub
+ https://github.com/jrimum/utilix/issues
+
+
+
+ http://github.com/jrimum/utilix
+
+
+
+
+ Gilmar P. S. L.
+ gilmatryx@gmail.com
+
+
+ Misael Barreto
+ misaelbarreto@gmail.com
+
+
+ Rômulo Augusto
+ romulomail@gmail.com
+
+
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+
+ 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
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.16
+
+ false
+
+ org/jrimum/utilix/**/*
+
+
+ org/jrimum/utilix/excludes/**/*
+ org/jrimum/utilix/**/*$*
+
+
+
+
+ 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
+
+
+
+
+
+
+ commons-lang
+ commons-lang
+ 2.4
+
+
+
+ log4j
+ log4j
+ 1.2.15
+
+
+ mail
+ javax.mail
+
+
+ jms
+ javax.jms
+
+
+ jmxtools
+ com.sun.jdmk
+
+
+ jmxri
+ com.sun.jmx
+
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+ rj-releases
+ http://52.5.53.15:8081/nexus/content/repositories/releases/
+
+
+
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Arrays.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Arrays.java
new file mode 100644
index 0000000..0ca4575
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Arrays.java
@@ -0,0 +1,412 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix;
+
+/**
+ *
+ * Classe utilitária para validações de arrays em geral.
+ *
+ *
+ *
+ * Inicialmente fornece métodos booleanos para verificação da existência de elementos.
+ *
+ *
+ * @author Gilmar P.S.L.
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public final class Arrays {
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Arrays() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ *
+ * Indica se um dado array de chars tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(char[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de booleans tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a
+ * - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(boolean[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de bytes tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(byte[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de shorts tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(short[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de ints tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(int[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de longs tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(long[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de floats tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(float[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de doubles tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(double[] a){
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Indica se um dado array de objetos tem elementos sem gerar NPE.
+ *
+ *
+ * Resposta direta para o seguinte código:
+ * (a != null && a > 0).
+ *
+ *
+ * @param a - O array a ser testado.
+ *
+ * @return (a != null && a > 0)
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(Object[] a) {
+
+ return (a != null && a.length > 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(char[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(boolean[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(byte[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(short[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(int[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(long[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(float[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(double[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+ /**
+ *
+ * Retorna a quantidade de elementos de um dado array sem gerar NPE.
+ *
+ *
+ * Resposta direata para o seguinte código:
+ * (a != null ? a.length : 0).
+ *
+ *
+ * @param a
+ * - Array com ou sem elementos.
+ *
+ * @return (a != null ? a.length : 0)
+ */
+ public static int length(Object[] a){
+
+ return (a != null ? a.length : 0);
+ }
+
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/ClassLoaders.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/ClassLoaders.java
new file mode 100644
index 0000000..43fbc04
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/ClassLoaders.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2010 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: 27/10/2010 - 01:40:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 27/10/2010 - 01:40:00
+ *
+ */
+
+package org.jrimum.utilix;
+
+import static java.lang.String.format;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * Utilitário para carregamento de recursos da apliacação por meio do classpath.
+ *
+ *
+ * @author Gilmar P.S.L.
+ */
+public final class ClassLoaders {
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private ClassLoaders() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ * Carrega um recurso existente no classpath.
+ *
+ * @param resourceName
+ * - O nome do resource a ser carregado
+ * @return URL para o recurso (resource).
+ */
+ public static URL getResource(String resourceName) {
+
+ return getResource(resourceName, null);
+ }
+
+ /**
+ * Carrega um recurso existente no classpath com ou sem uma classe
+ * informada.
+ *
+ *
+ * Informando a classe há necessidade de informar o caminho do pacote, caso
+ * o recurso esteja nele.
+ *
+ *
+ * @param resourceName
+ * - O nome do resource a ser carregado
+ * @param callingClass
+ * - A classe do objeto chamador ou outro.
+ * @return URL para o recurso (resource).
+ */
+ public static URL getResource(String resourceName, Class> callingClass) {
+
+ URL url = null;
+
+ if (callingClass != null) {
+
+ url = callingClass.getResource(resourceName);
+
+ if (url == null) {
+
+ url = callingClass.getClassLoader().getResource(resourceName);
+
+ }else{
+
+ return url;
+ }
+
+ if (url == null) {
+
+ String inPagckage = format("%s/%s", callingClass.getPackage().getName().replaceAll("\\.", "/"), resourceName);
+
+ url = Thread.currentThread().getContextClassLoader().getResource(inPagckage);
+
+ } else {
+
+ return url;
+ }
+ }
+
+ if (url == null) {
+
+ url = ClassLoaders.class.getResource(resourceName);
+
+ }else{
+
+ return url;
+ }
+
+ if (url == null) {
+
+ url = ClassLoaders.class.getClassLoader().getResource(resourceName);
+
+ }else{
+
+ return url;
+ }
+
+ if (url == null) {
+
+ url = Thread.currentThread().getContextClassLoader().getResource(
+ resourceName);
+ }
+
+ return url;
+ }
+
+ /**
+ * Carrega um recurso existente no classpath sob a forma de stream.
+ *
+ * @param resourceName
+ * - O nome do resource a ser carregado
+ * @return Stream aberto para o recurso (resource).
+ */
+ public static InputStream getResourceAsStream(String resourceName) {
+
+ return getResourceAsStream(resourceName, null);
+ }
+
+ /**
+ * Carrega um recurso existente no classpath sob a forma de stream com ou
+ * sem uma classe informada.
+ *
+ * @param resourceName
+ * - O nome do resource a ser carregado
+ * @param callingClass
+ * - A classe do objeto chamador ou outro.
+ * @return Stream aberto para o recurso (resource).
+ */
+ public static InputStream getResourceAsStream(String resourceName,
+ Class> callingClass) {
+
+ try {
+
+ return getResource(resourceName, callingClass).openStream();
+
+ } catch (IOException e) {
+
+ return Exceptions.throwIllegalStateException(e);
+ }
+ }
+
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Collections.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Collections.java
new file mode 100644
index 0000000..4aee3ec
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Collections.java
@@ -0,0 +1,512 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Classe utilitária para validações de coleções em geral, com e sem exceções.
+ *
+ *
+ * Fornece métodos booleanos e métodos que verificam se uma coleção está de
+ * acordo com o desejado e, caso não estejam, lançam exceção.
+ *
+ *
+ * @author Gilmar P.S.L.
+ * @author Rômulo Augusto
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public final class Collections {
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Collections() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ * Verifica se a Collection passada por parâmetro é
+ * null ou não possui elementos e lança
+ * exceção caso não preencha estes requisitos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ *
+ * @throws IllegalArgumentException - Caso a coleção não
+ * seja null e possua elementos.
+ *
+ * @see #checkEmpty(Collection, String)
+ * @see #isEmpty(Collection)
+ * @see #isNotEmpty(Collection)
+ *
+ * @since 0.2
+ */
+ public static void checkEmpty(Collection> collection) {
+
+ checkEmpty(collection, "Collection não nulo e com elementos! Valor ["
+ + collection + "].");
+ }
+
+ /**
+ * Verifica se a Collection passado por parâmetro é
+ * null ou não possui elementos e lança
+ * exceção, com a mensagem informada, caso não preencha estes requisitos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ * @param message
+ * - Mensagem utilizada na exceção.
+ *
+ * @throws IllegalArgumentException - Caso a coleção não
+ * seja null e possua elementos.
+ *
+ * @see #isEmpty(Collection)
+ * @see #isNotEmpty(Collection)
+ *
+ * @since 0.2
+ */
+ public static void checkEmpty(Collection> collection, String message) {
+
+ if (hasElement(collection)) {
+
+ Exceptions.throwIllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * Verifica se a Collection passada por parâmetro
+ * não é null e possui elementos e lança
+ * exceção caso não preencha estes requisitos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ *
+ * @throws IllegalArgumentException
+ * - Caso a coleção seja null ou a coleção
+ * não possua elementos.
+ *
+ * @see #checkNotEmpty(Collection, String)
+ * @see #isEmpty(Collection)
+ * @see #isNotEmpty(Collection)
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Collection> collection) {
+
+ checkNotEmpty(collection, "Objeto nulo!", "Collection sem elementos!");
+ }
+
+ /**
+ * Verifica se a Collection passada por parâmetro
+ * não é null e possui elementos e lança
+ * exceção, com a mensagem informada, caso não preencha estes requisitos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ * @param message
+ * - Mensagem utiliada na exceção.
+ *
+ * @throws IllegalArgumentException
+ * - Caso a coleção seja null ou a coleção
+ * não possua elementos.
+ *
+ * @see #isEmpty(Collection)
+ * @see #isNotEmpty(Collection)
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Collection> collection, String message) {
+
+ checkNotEmpty(collection, message, message);
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro é null
+ * ou não possui elementos e lança exceção caso não
+ * preencha estes requisitos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ *
+ * @throws IllegalArgumentException - Caso o mapa não seja
+ * null e possua elementos.
+ *
+ * @see #checkEmpty(Map, String)
+ * @see #isEmpty(Map)
+ * @see #isNotEmpty(Map)
+ *
+ * @since 0.2
+ */
+ public static void checkEmpty(Map, ?> map) {
+
+ checkEmpty(map, "Map não nulo e com elementos. Valor [" + map + "]");
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro é null
+ * ou não possui elementos e lança exceção, com a mensagem
+ * informada, caso não preencha estes requisitos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ * @param message
+ * - Mensagem utilizada na exceção.
+ *
+ * @throws IllegalArgumentException - Caso o mapa não seja
+ * null e possua elementos.
+ *
+ * @see #isEmpty(Map)
+ * @see #isNotEmpty(Map)
+ *
+ * @since 0.2
+ */
+ public static void checkEmpty(Map, ?> map, String message) {
+
+ if (hasElement(map)) {
+
+ Exceptions.throwIllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro não
+ * é null e possui elementos e lança exceção caso não preencha
+ * estes requisitos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ *
+ * @throws IllegalArgumentException
+ * - Caso o mapa seja null ou o mapa
+ * não possua elementos.
+ *
+ * @see #checkNotEmpty(Map, String)
+ * @see #isEmpty(Map)
+ * @see #isNotEmpty(Map)
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Map, ?> map) {
+
+ checkNotEmpty(map, "Objeto nulo", "Map sem elementos");
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro não
+ * é null e possui elementos e lança exceção, com a mensagem
+ * informada, caso não preencha estes requisitos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ * @param message
+ * - Mensagem utiliada na exceção.
+ *
+ * @throws IllegalArgumentException
+ * - Caso o mapa seja null ou o mapa
+ * não possua elementos.
+ *
+ * @see #isEmpty(Map)
+ * @see #isNotEmpty(Map)
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Map, ?> map, String message) {
+
+ checkNotEmpty(map, message, message);
+ }
+
+ /**
+ * Verifica se a Collection passada por parâmetro é
+ * null ou não possui elementos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ * @return !hasElement(collection)
+ *
+ * @since 0.2
+ */
+ public static boolean isEmpty(Collection> collection) {
+
+ return !hasElement(collection);
+ }
+
+ /**
+ * Verifica se a Collection passada por parâmetro
+ * não é null e possui elementos.
+ *
+ * @param collection
+ * - Instância de Collection analisada.
+ * @return hasElement(collection)
+ *
+ * @see #isEmpty(Collection)
+ *
+ * @since 0.2
+ */
+ public static boolean isNotEmpty(Collection> collection) {
+
+ return hasElement(collection);
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro é null
+ * ou não possui elementos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ * @return !hasElement(map)
+ *
+ * @since 0.2
+ */
+ public static boolean isEmpty(Map, ?> map) {
+
+ return !hasElement(map);
+ }
+
+ /**
+ * Verifica se o Map passado por parâmetro não
+ * é null e possui elementos.
+ *
+ * @param map
+ * - Instância de Map analisada.
+ * @return hasElement(map)
+ *
+ * @see #isEmpty(Map)
+ *
+ * @since 0.2
+ */
+ public static boolean isNotEmpty(Map, ?> map) {
+
+ return hasElement(map);
+ }
+
+ /**
+ * Indica se pelo menos uma coleção tem algum elemento sem gerar NPE.
+ *
+ * @param cols
+ * - Coleções para teste.
+ *
+ * @return indicativo
+ */
+ public static boolean hasElement(Collection> ... cols) {
+
+ if(Arrays.hasElement(cols)){
+
+ for(Collection> c : cols){
+ if(hasElement(c)){
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Indica se pelo menos um mapa tem algum elemento sem gerar NPE.
+ *
+ * @param maps
+ * - Mapas para teste.
+ *
+ * @return indicativo
+ */
+ public static boolean hasElement(Map, ?> ... maps) {
+
+ if(Arrays.hasElement(maps)){
+
+ for(Map, ?> m : maps){
+ if(hasElement(m)){
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Indica se uma dada coleção tem elementos sem gerar NPE.
+ *
+ * Resposta direta para o seguinte código:
+ * (c != null && !c.isEmpty()).
+ *
+ *
+ * @param c
+ * - A coleção a ser testada.
+ *
+ * @return (c != null && !c.isEmpty())
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(Collection> c) {
+
+ return (c != null && !c.isEmpty());
+ }
+
+ /**
+ * Indica se um dado mapa tem elementos sem gerar NPE.
+ *
+ * Resposta direata para o seguinte código:
+ * (m != null && !m.isEmpty()).
+ *
+ *
+ * @param m
+ * - O mapa a ser testado.
+ *
+ * @return (m != null && !m.isEmpty())
+ *
+ * @since 0.2
+ */
+ public static boolean hasElement(Map, ?> m) {
+
+ return (m != null && !m.isEmpty());
+ }
+
+ /**
+ * Retorna a quantidade de elementos de uma dada coleção sem gerar NPE.
+ *
+ * Resposta direata para o seguinte código:
+ * (c != null ? c.size() : 0).
+ *
+ *
+ * @param c
+ * - Coleção com ou sem elementos.
+ *
+ * @return (c != null ? c.size() : 0)
+ */
+ public static int size(Collection> c) {
+
+ return (c != null ? c.size() : 0);
+ }
+
+ /**
+ * Retorna a quantidade de elementos de um dado mapa sem gerar NPE.
+ *
+ * Resposta direata para o seguinte código:
+ * (m != null ? m.size() : 0).
+ *
+ *
+ * @param m
+ * - Mapa com ou sem elementos.
+ *
+ * @return (m != null ? m.size() : 0)
+ */
+ public static int size(Map, ?> m) {
+
+ return (m != null ? m.size() : 0);
+ }
+
+ /**
+ * Verifica se o coleção passado por parâmetro não é
+ * null ou se é vazio.
+ *
+ * Caso o objeto seja null, lança
+ * NullPointerException com a mensagem informada no parâmetro
+ * messageNullPointer (primeiro parâmetro String). Caso o
+ * objeto não seja null e não possua elementos, lança
+ * IllegalArgumentException com a mensagem informada no
+ * parâmetro messageIllegalArgument (segundo parâmetro String).
+ *
+ *
+ * @param collection
+ * - Objeto analisado.
+ * @param messageNullPointer
+ * - Mensagem utiliada na exceção
+ * IllegalArgumentException.
+ * @param messageIllegalArgument
+ * - Mensagem utiliada na exceção
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Collection> collection,
+ String messageNullPointer, String messageIllegalArgument) {
+
+ if (collection == null) {
+
+ Exceptions.throwIllegalArgumentException(messageNullPointer);
+ }
+
+ if (collection.isEmpty()) {
+
+ Exceptions.throwIllegalArgumentException(messageIllegalArgument);
+ }
+ }
+
+ /**
+ * Verifica se o mapa passado por parâmetro não é
+ * null ou se é vazio.
+ *
+ * Caso o objeto seja null, lança
+ * NullPointerException com a mensagem informada no parâmetro
+ * messageNullPointer (primeiro parâmetro String). Caso o
+ * objeto não seja null e não possua elementos, lança
+ * IllegalArgumentException com a mensagem informada no
+ * parâmetro messageIllegalArgument (segundo parâmetro String).
+ *
+ *
+ * @param map
+ * - Objeto analisado.
+ * @param messageNullPointer
+ * - Mensagem utiliada na exceção
+ * IllegalArgumentException.
+ * @param messageIllegalArgument
+ * - Mensagem utiliada na exceção
+ * IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ *
+ * @since 0.2
+ */
+ public static void checkNotEmpty(Map, ?> map, String messageNullPointer,
+ String messageIllegalArgument) {
+
+ if (map == null) {
+
+ Exceptions.throwIllegalArgumentException(messageNullPointer);
+ }
+
+ if (map.isEmpty()) {
+
+ Exceptions.throwIllegalArgumentException(messageIllegalArgument);
+ }
+ }
+
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Dates.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Dates.java
new file mode 100644
index 0000000..412a3d7
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Dates.java
@@ -0,0 +1,253 @@
+/*
+ * 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:40
+ *
+ * ================================================================================
+ *
+ * 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:40
+ *
+ */
+
+package org.jrimum.utilix;
+
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.commons.lang.time.DateUtils;
+
+/**
+ *
+ * Serviços utilitários relacionados a manipulação de Objetos
+ * Date, Calendar, GregorianCalendar.
+ *
+ * Representa uma data inexistente, pode ser usada em casos que não se pode
+ * usar null [ é obtida da seguinte forma:
+ * Calendar.set(1, 0, 1) ]
+ *
+ */
+ private static final Date DATE_NULL;
+
+ static {
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(1, 0, 1);
+ calendar.setLenient(false);
+ DATE_NULL = DateUtils.truncate(calendar.getTime(), Calendar.YEAR);
+ }
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Dates() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ *
+ * Retorna uma data inexistente, pode ser usada em casos que não se pode
+ * usar null [ é obtida da seguinte forma:
+ * Calendar.set(1, 0, 1) ]
+ *
+ *
+ * @return data invalida - 01/01/0001
+ */
+ public static Date invalidDate(){
+
+ return (Date) DATE_NULL.clone();
+ }
+
+ /**
+ *
+ * Compara uma dada data qualquer com a data invalida 01/01/0001.
+ *
+ *
+ * @param date - Data qualquer
+ *
+ * @return igualdade - Se igual a data inválida
+ */
+ public static boolean equalsInvalidDate(Date date){
+
+ if(date == null){
+
+ return false;
+
+ }else{
+
+ return (DATE_NULL.compareTo(date) == 0);
+ }
+ }
+
+ /**
+ *
+ * Calcula a diferença de dias entre duas datas. O resultado é modular, ou
+ * seja, maior ou igual a zero, logo a data final não precisa ser
+ * necessariamente maior que a data inicial.
+ *
+ *
+ * @param dataInicial
+ * - data inicial do intervalo.
+ * @param dataFinal
+ * - data final do intervalo.
+ * @return número(módulo) de dias entre as datas.
+ *
+ * @throws IllegalArgumentException
+ * Caso pelo menos uma das duas datas seja null.
+ * @since 0.2
+ */
+ public static long calculeDiferencaEmDias(final Date dataInicial, final Date dataFinal) {
+
+ long fator = 0;
+
+ Date dataInicialTruncada, dataFinalTruncada;
+
+ if (isNotNull(dataInicial) && isNotNull(dataFinal)) {
+
+ dataInicialTruncada = DateUtils.truncate(dataInicial, Calendar.DATE);
+ dataFinalTruncada = DateUtils.truncate(dataFinal, Calendar.DATE);
+
+ fator = ((dataFinalTruncada.getTime() - dataInicialTruncada.getTime()) / DateUtils.MILLIS_PER_DAY);
+
+ if (fator < 0) {
+ fator *= -1;
+ }
+
+ } else {
+
+ Exceptions.throwIllegalArgumentException("A data inicial [" + dataInicial
+ + "] e a data final [" + dataFinal + "] "
+ + "não podem ter valor 'null'.");
+ }
+
+ return fator;
+ }
+
+ /**
+ *
+ * Converte um objeto String em um objeto
+ * java.util.Date a partir do formato de data especificado.
+ *
+ *
+ * Utiliza a sobrecarca
+ * parse(String dateAsString, String dateFormat) para
+ * realizar a conversão.
+ *
+ *
+ * @param dateAsString
+ * - um valor de data em forma de String.
+ * @param dateFormat
+ * - formato de data em forma de String.
+ * @return Objeto java.util.Date convertido a partir do objeto
+ * String
+ *
+ * @throws IllegalArgumentException
+ * caso o objeto String não seja um valor válido de
+ * data suportado pelo formato.
+ * @since 0.2
+ */
+ public static Date parse(String dateAsString, String dateFormat) {
+
+ if (dateFormat == null) {
+ throw new NullPointerException("O formato da data não pode ter valor [null].");
+ }
+
+ return parse(dateAsString, new SimpleDateFormat(dateFormat));
+ }
+
+ /**
+ *
+ * Converte um objeto String em um objeto
+ * java.util.Date através do objeto
+ * java.text.DateFormat especificado.
+ *
+ *
+ * @param dateAsString
+ * - um valor de data em forma de String.
+ * @param dateFormat
+ * - formatador para objetos java.util.Date.
+ * @return Objeto java.util.Date convertido a partir do objeto
+ * String
+ *
+ * @throws IllegalArgumentException
+ * caso o objeto String não seja um valor válido de
+ * data suportado pelo formatador.
+ * @since 0.2
+ */
+ public static Date parse(String dateAsString, DateFormat dateFormat) {
+
+ Date date = null;
+
+ if (dateAsString == null) {
+ throw new NullPointerException("A String a ser convertida não pode ter valor [null].");
+ }
+
+ if (dateFormat == null) {
+ throw new NullPointerException("O formatador não pode ter valor [null].");
+ }
+
+ try {
+
+ date = dateFormat.parse(dateAsString);
+
+ } catch (ParseException e) {
+
+ String msg = "A String [" + dateAsString
+ + "] deve ser uma data válida no formato";
+ if (dateFormat instanceof SimpleDateFormat) {
+ SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
+ msg += " [" + sdf.toPattern() + "].";
+
+ } else {
+ msg += " especificado.";
+ }
+
+ IllegalArgumentException iae = new IllegalArgumentException(msg);
+ iae.initCause(e);
+ throw iae;
+ }
+
+ return date;
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Exceptions.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Exceptions.java
new file mode 100644
index 0000000..61ebce3
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Exceptions.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2011 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: 15/05/2011 - 17:54:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2011 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.
+ *
+ * Created at: 15/05/2011 - 17:54:00
+ *
+ */
+
+package org.jrimum.utilix;
+
+/**
+ * Classe utilitária para lançar exceções de modo ecapsulado.
+ *
+ * @author Gilmar P.S.L.
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public class Exceptions {
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Exceptions() {
+
+ throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalArgumentException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalArgumentException() {
+
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalArgumentException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param message
+ * Mensagem usada na exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalArgumentException(String message) {
+
+ throw new IllegalArgumentException(message);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalArgumentException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalArgumentException(Throwable cause) {
+
+ throw new IllegalArgumentException(cause);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalArgumentException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @param message
+ * Mensagem usada na exceção
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalArgumentException(String message,
+ Throwable cause) {
+
+ throw new IllegalArgumentException(message, cause);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalStateException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalStateException() {
+
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalStateException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param message
+ * Mensagem usada na exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalStateException(String message) {
+
+ throw new IllegalStateException(message);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalStateException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalStateException(Throwable cause) {
+
+ throw new IllegalStateException(cause);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain IllegalStateException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @param message
+ * Mensagem usada na exceção
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwIllegalStateException(String message,
+ Throwable cause) {
+
+ throw new IllegalStateException(message, cause);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain UnsupportedOperationException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwUnsupportedOperationException() {
+
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain UnsupportedOperationException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param message
+ * Mensagem usada na exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwUnsupportedOperationException(String message) {
+
+ throw new UnsupportedOperationException(message);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain UnsupportedOperationException}.
+ *
+ * @param
+ * Qualquer tipo.
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwUnsupportedOperationException(Throwable cause) {
+
+ throw new UnsupportedOperationException(cause);
+ }
+
+ /**
+ * Lança imediatamente uma {@linkplain UnsupportedOperationException}.
+ *
+ * @param
+ * Qualquer tipo.
+ *
+ * @param message
+ * Mensagem usada na exceção
+ * @param cause
+ * Causa da exceção
+ *
+ * @return Não retorna nada, criado apenas para satisfazer alguma condição
+ * de retorno.
+ */
+ public static T throwUnsupportedOperationException(String message,
+ Throwable cause) {
+
+ throw new UnsupportedOperationException(message, cause);
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Locales.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Locales.java
new file mode 100644
index 0000000..f70d348
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Locales.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix;
+
+/**
+ *
+ * Locales não disponíveis em java.util.Locale.
+ *
+ */
+ public static final java.util.Locale BRASIL = new java.util.Locale("pt", "BR");
+
+ /**
+ *
+ * Utility class pattern: classe não instanciável
+ *
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Locales() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/Objects.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/Objects.java
new file mode 100644
index 0000000..01e8002
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/Objects.java
@@ -0,0 +1,362 @@
+/*
+ * 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:02:40
+ *
+ * ================================================================================
+ *
+ * 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:02:40
+ *
+ */
+
+package org.jrimum.utilix;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * Classe utilitária para validações de objetos em geral, como verificações de
+ * objetos nulos, com e sem exceções.
+ *
+ *
+ * Fornece métodos booleanos e métodos que verificam se o valor do objeto está
+ * de acordo com o desejado e, caso não estejam, lançam exceção.
+ *
+ *
+ * @author Gilmar P.S.L.
+ * @author Rômulo Augusto
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public final class Objects {
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws IllegalStateException
+ * Caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Objects() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ * Verifica se o objeto passado por parâmetro é {@code null}.
+ *
+ * @param object
+ * - Objeto analisado
+ *
+ * @return (object == null)
+ *
+ * @since 0.2
+ */
+ public static boolean isNull(Object object) {
+
+ return (object == null);
+ }
+
+ /**
+ * Verifica se o objeto passado por parâmetro não é
+ * {@code null}.
+ *
+ * É o mesmo que usar o método {@code isNull} da forma
+ * {@code !isNull(obj)}, porém de forma mais legível.
+ *
+ *
+ * @param object
+ * - Objeto analisado
+ *
+ * @return (object != null)
+ *
+ * @see #isNull(Object)
+ *
+ * @since 0.2
+ */
+ public static boolean isNotNull(Object object) {
+
+ return (object != null);
+ }
+
+ /**
+ * Verifica se existe uma referência ao objeto dado.
+ *
+ * @param object
+ * - Objeto analisado
+ *
+ * @return (object != null);
+ *
+ * @see #isNotNull(Object)
+ *
+ * @since 0.2
+ */
+ public static boolean exists(Object object) {
+
+ return (object != null);
+ }
+
+ /**
+ * Verifica a verdade de uma expressão e lança uma
+ * {@code IllegalArgumentException}, caso a expressão seja
+ * false.
+ *
+ * @param expression
+ * - Qualquer expressão booleana
+ * @throws IllegalArgumentException
+ * se {@code expression == false}
+ *
+ * @since 0.2
+ */
+ public static void checkArgument(boolean expression) {
+
+ if (!expression) {
+ Exceptions.throwIllegalArgumentException();
+ }
+ }
+
+ /**
+ * Verifica a verdade de uma expressão e lança uma
+ * {@code IllegalArgumentException}, com a mensagem iformada, caso a
+ * expressão seja false.
+ *
+ * @param expression
+ * - Qualquer expressão booleana
+ * @param message
+ * - Mensagem utilizada na exceção
+ * @throws IllegalArgumentException
+ * se {@code expression == false}
+ *
+ * @since 0.2
+ */
+ public static void checkArgument(boolean expression, String message) {
+
+ if (!expression) {
+ Exceptions.throwIllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * Verifica a verdade de uma expressão e lança uma
+ * {@code IllegalStateException}, caso a expressão seja
+ * false.
+ *
+ * @param expression
+ * - Qualquer expressão booleana
+ * @throws IllegalStateException
+ * se {@code expression == false}
+ *
+ * @since 0.2
+ */
+ public static void checkState(boolean expression) {
+
+ if (!expression) {
+ Exceptions.throwIllegalStateException();
+ }
+ }
+
+ /**
+ * Verifica a verdade de uma expressão e lança uma
+ * {@code IllegalStateException}, com a mensagem iformada, caso a
+ * expressão seja false.
+ *
+ * @param expression
+ * - Qualquer expressão booleana
+ * @param message
+ * - Mensagem utilizada na exceção
+ * @throws IllegalStateException
+ * se {@code expression == false}
+ *
+ * @since 0.2
+ */
+ public static void checkState(boolean expression, String message) {
+
+ if (!expression) {
+ Exceptions.throwIllegalStateException(message);
+ }
+ }
+
+ /**
+ * Verifica se o objeto é nulo e lança {@code IllegalArgumentException}
+ * , com a mensagem informada, caso não seja.
+ *
+ * @throws IllegalArgumentException - Caso o objeto não seja
+ * {@code null}.
+ *
+ * @see #isNull(Object)
+ * @see #isNotNull(Object)
+ *
+ * @since 0.2
+ *
+ * @param object
+ * - Objeto analisado
+ * @param message
+ * - Mensagem utilizada na exceção
+ */
+ public static void checkNull(Object object, String message) {
+
+ if (object != null) {
+
+ Exceptions.throwIllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * Verifica se o objeto é nulo e lança {@code IllegalArgumentException}
+ * caso não seja.
+ *
+ * @param object
+ * - Objeto analisado
+ *
+ * @throws IllegalArgumentException - Caso o objeto não seja
+ * {@code null}.
+ *
+ * @see #checkNull(Object, String)
+ * @see #isNull(Object)
+ * @see #isNotNull(Object)
+ *
+ * @since 0.2
+ */
+ public static void checkNull(Object object) {
+
+ checkNull(object, new StringBuilder("Objeto não nulo! Valor [ ")
+ .append(object).append(" ].").toString());
+ }
+
+ /**
+ * Verifica se o objeto não é nulo e lança
+ * {@code IllegalArgumentException}, com a mensagem informada, caso
+ * seja.
+ *
+ * @param object
+ * - Objeto analisado
+ * @param message
+ * - Mensagem utilizada na exceção
+ *
+ * @throws IllegalArgumentException - Caso o objeto seja {@code null}.
+ *
+ * @see #isNull(Object)
+ * @see #isNotNull(Object)
+ *
+ * @since 0.2
+ */
+ public static void checkNotNull(Object object, String message) {
+
+ if (object == null) {
+
+ Exceptions.throwIllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * Verifica se o objeto não é nulo e lança
+ * {@code IllegalArgumentException} caso seja.
+ *
+ * @param object
+ * - Objeto analisado
+ *
+ * @throws IllegalArgumentException - Caso o objeto seja {@code null}.
+ *
+ * @see #checkNotNull(Object, String)
+ * @see #isNull(Object)
+ * @see #isNotNull(Object)
+ *
+ * @since 0.2
+ */
+ public static void checkNotNull(Object object) {
+
+ checkNotNull(object, "Objeto nulo!");
+ }
+
+ /**
+ * Retorna um dado valor padrão quando o determinado objeto for nulo.
+ *
+ *
+ *
+ * @param
+ * tipo do objeto pretendido
+ * @param object
+ * - O {@code objeto} a testar, pode ser {@code null}
+ * @param defaultValue
+ * - O valor padrão retornado, pode ser {@code null}
+ * @return {@code object} - Se não nulo, caso contrário
+ * {@code defaultValue}
+ *
+ * @since 0.2
+ */
+ @SuppressWarnings("unchecked")
+ public static T whenNull(Object object, Object defaultValue) {
+
+ return (T) (object != null ? object : defaultValue);
+ }
+
+ /**
+ * Retorna um dado valor padrão quando o determinado objeto for nulo e outro
+ * valor quando contrário.
+ *
+ *
+ *
+ * @param
+ * tipo do objeto pretendido
+ * @param object
+ * - O {@code objeto} a testar, pode ser {@code null}
+ * @param defaultValue
+ * - O valor padrão retornado, pode ser {@code null}
+ * @param notDefaultValue
+ * - O valor quando {@code object} é nulo, pode ser
+ * {@code null}
+ * @return {@code defaultValue} - Se não nulo, caso contrário
+ * {@code notDefaultValue}
+ *
+ * @since 0.2
+ */
+ @SuppressWarnings("unchecked")
+ public static T whenNull(Object object, Object defaultValue,
+ Object notDefaultValue) {
+
+ return (T) (object == null ? defaultValue : notDefaultValue);
+ }
+
+ /**
+ * Exibe os valores de instância para um objeto JRimum.
+ *
+ * @see org.apache.commons.lang.builder.ToStringBuilder#reflectionToString
+ *
+ * @since 0.2
+ *
+ * @see java.lang.Object#toString()
+ */
+ public static String toString(Object obj) {
+
+ return "JRimumObject: " + ToStringBuilder.reflectionToString(obj);
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/package-info.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/package-info.java
new file mode 100644
index 0000000..d119745
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010 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: 15/08/2010 - 15:37:49
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 15/08/2010 - 15:37:49
+ *
+ */
+
+/**
+ * Classes utilitárias ou de propósito comum, que são necessárias ao projeto.
+ *
+ * @author Gilmar P.S.L
+ */
+package org.jrimum.utilix;
\ No newline at end of file
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DateFormat.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DateFormat.java
new file mode 100644
index 0000000..362b56f
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DateFormat.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 17:31:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 17:31:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.jrimum.utilix.Exceptions;
+
+/**
+ *
+ * Formatadores de data thread-safe. Para uma mesma categoria, os formatadores
+ * atualmente são diferenciados pelos seus separadores ("formato_separador")
+ * exemplos:
+ *
+ * Formatador de datas no padrão "dd/MM/yyyy".
+ *
+ */
+ DDMMYYYY_B("dd/MM/yyyy"),
+
+ /**
+ *
+ * Formatador de datas no padrão "dd-MM-yyyy".
+ *
+ */
+ DDMMYYYY_H("dd-MM-yyyy"),
+
+ /**
+ *
+ * Formatador de datas no padrão "dd_MM_yyyy".
+ *
+ */
+ DDMMYYYY_U("dd_MM_yyyy"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yyMMdd".
+ *
+ */
+ YYMMDD("yyMMdd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yy/MM/dd".
+ *
+ */
+ YYMMDD_B("yy/MM/dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yy/MM/dd".
+ *
+ */
+ YYMMDD_H("yy-MM-dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yy_MM_dd".
+ *
+ */
+ YYMMDD_U("yy_MM_dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yyyyMMdd".
+ *
+ */
+ YYYYMMDD("yyyyMMdd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yyyy/MM/dd".
+ *
+ */
+ YYYYMMDD_B("yyyy/MM/dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yyyy-MM-dd".
+ *
+ */
+ YYYYMMDD_H("yyyy-MM-dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "yyyy_MM_dd".
+ *
+ */
+ YYYYMMDD_U("yyyy_MM_dd"),
+
+ /**
+ *
+ * Formatador de datas no padrão "hhmmss".
+ *
+ */
+ HHMMSS("hhmmss"),
+
+ /**
+ *
+ * Formatador de datas no padrão "HHmmss".
+ *
+ */
+ HHMMSS_24("HHmmss"),
+
+ /**
+ *
+ * Formatador de datas no padrão "hh:mm:ss".
+ *
+ */
+ HHMMSS_C("hh:mm:ss"),
+
+ /**
+ *
+ * Formatador de datas no padrão "HH:mm:ss".
+ *
+ */
+ HHMMSS_24C("HH:mm:ss"),
+ ;
+
+ private final ThreadLocalFormat DATE_FORMAT;
+
+ private DateFormat(String format) {
+
+ DATE_FORMAT = new ThreadLocalFormat(format){
+
+ @Override
+ protected SimpleDateFormat initialValue() {
+
+ return new SimpleDateFormat(format);
+ }
+
+ };
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#format(java.lang.Object)
+ */
+ public String format(Date obj) {
+
+ return DATE_FORMAT.get().format(obj);
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#parse(java.lang.String)
+ */
+ public Date parse(String text) {
+
+ try {
+
+ return DATE_FORMAT.get().parse(text);
+
+ } catch (ParseException e) {
+
+ return Exceptions.throwIllegalArgumentException("DateFormat Exception!", e);
+ }
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#copy()
+ */
+ public SimpleDateFormat copy(){
+
+ return (SimpleDateFormat) DATE_FORMAT.get().clone();
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormat.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormat.java
new file mode 100644
index 0000000..4432546
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormat.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+import java.text.ParseException;
+
+import org.jrimum.utilix.Exceptions;
+
+/**
+ *
+ * Formatadores thread-safe relacionados a moeda e números decimais.
+ *
+ * Formatador de decimais Float,Double,BigDecimal no padrão de
+ * moeda (Real pt-BR): "R$ #,##0.0". Usado para formatar valores
+ * monetários em real com o prefixo R$, exemplo: R$ 10,0.
+ *
+ * Formatador de decimais Float,Double,BigDecimal no padrão de
+ * moeda (Real pt-BR): "R$ #,##0.00". Usado para formatar valores
+ * monetários em real com o prefixo R$, exemplo: R$ 10,00.
+ *
+ */
+ MONEY_DD_BR("\u00A4 #,##0.00", DecimalFormatSymbols.BRASIL.copy()),
+
+ ;
+
+ private final ThreadLocalLocalizedFormat DECIMAL_FORMAT;
+
+ private DecimalFormat(String format, java.text.DecimalFormatSymbols formatSymbols) {
+
+ DECIMAL_FORMAT = new ThreadLocalLocalizedFormat(format, formatSymbols){
+
+ @Override
+ protected java.text.DecimalFormat initialValue() {
+
+ return new java.text.DecimalFormat(format, formatSymbols);
+ }
+ };
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#format(java.lang.Object)
+ */
+ public String format(Number obj) {
+
+ return DECIMAL_FORMAT.get().format(obj);
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#parse(java.lang.String)
+ */
+ public Number parse(String text) {
+
+ try {
+
+ return DECIMAL_FORMAT.get().parse(text);
+
+ } catch (ParseException e) {
+
+ return Exceptions.throwIllegalArgumentException("DecimalFormat Exception!", e);
+ }
+ }
+
+ /**
+ * @see org.jrimum.utilix.text.Format#copy()
+ */
+ public java.text.DecimalFormat copy(){
+
+ return (java.text.DecimalFormat) DECIMAL_FORMAT.get().clone();
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormatSymbols.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormatSymbols.java
new file mode 100644
index 0000000..e7c193c
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/DecimalFormatSymbols.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+import java.util.Currency;
+
+import org.jrimum.utilix.Locales;
+
+/**
+ *
+ * DecimalFormatSymbols com localização (Processo de localização) inicialmente
+ * do Brasil.
+ *
+ *
+ * @return símbolos - Instância de
+ * java.text.DecimalFormatSymbols estilo pt-BR
+ *
+ * @since 0.2
+ */
+ public java.text.DecimalFormatSymbols copy() {
+
+ return (java.text.DecimalFormatSymbols) DF_SYMBOLS.get().clone();
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Format.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Format.java
new file mode 100644
index 0000000..6d1fda4
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Format.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 17:31:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 17:31:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+/**
+ *
+ * Interface usada para objetos formatadores utilizados em leitura e escrita de
+ * textos.
+ *
+ * Transforma uma string formatada em um objeto correspondente.
+ *
+ *
+ * @param text
+ * - Texto a ser analisado e transformado em objeto.
+ * @return objeto - Resultado da transformação da string.
+ */
+ T parse(String text);
+
+ /**
+ *
+ * Devolve uma cópia do formatador utilizado pela instância.
+ *
+ *
+ * @return formatador - Cópia da instância do formatador.
+ */
+ F copy();
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Strings.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Strings.java
new file mode 100644
index 0000000..05bc70c
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/Strings.java
@@ -0,0 +1,516 @@
+/*
+ * 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:18:19
+ *
+ * ================================================================================
+ *
+ * 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:18:19
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+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.isNotBlank;
+import static org.apache.commons.lang.StringUtils.isNumeric;
+import static org.apache.commons.lang.StringUtils.leftPad;
+import static org.apache.commons.lang.StringUtils.removeStart;
+import static org.apache.commons.lang.StringUtils.replace;
+import static org.apache.commons.lang.StringUtils.replaceChars;
+import static org.apache.commons.lang.StringUtils.startsWith;
+import static org.jrimum.utilix.Objects.isNotNull;
+
+import org.apache.commons.lang.StringUtils;
+import org.jrimum.utilix.Exceptions;
+import org.jrimum.utilix.Objects;
+
+/**
+ * Esta classe tem a responsabilidade de prover serviços utilitários
+ * relacionados a manipulação de Strings
+ *
+ * @author Gilmar P.S.L
+ * @author Misael Barreto
+ * @author Rômulo Augusto
+ * @author Nordeste Fomento
+ * Mercantil
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public final class Strings {
+
+ public static final String WHITE_SPACE = " ";
+
+ /**
+ * Utility class pattern: classe não instanciável
+ *
+ * @throws AssertionError
+ * caso haja alguma tentativa de utilização deste construtor.
+ */
+ private Strings() {
+
+ Exceptions.throwIllegalStateException("Instanciação não permitida!");
+ }
+
+ /**
+ * Elimina simbolos como:
+ *
+ *
+ *
+ * @param str
+ * @return a string sem zeros inicias ou um único zero.
+ *
+ * @since 0.2
+ */
+
+ public static String removeStartWithZeros(final String str) {
+
+ String withoutZeros = EMPTY;
+ final String zero = "0";
+
+ if (isNotNull(str)) {
+
+ if (startsWith(str, zero)) {
+
+ withoutZeros = removeStart(str, zero);
+
+ while (startsWith(withoutZeros, zero)) {
+ withoutZeros = removeStart(withoutZeros, zero);
+ }
+
+ if (withoutZeros.trim().length() == 0) {
+ withoutZeros = zero;
+ }
+
+ } else {
+ withoutZeros = str;
+ }
+ }
+
+ return withoutZeros;
+ }
+
+ /**
+ * Remove a acentuação do texto, que inclui os acentos:
+ *
+ *
Agudo. ex.: á
+ *
Grave. ex.: à
+ *
Til. ex.: ã
+ *
Trema. ex.: ä
+ *
Circunflexo. ex.: â
+ *
+ * e o Cedilha (ç).
+ *
+ * Os acentos são removidos tanto para letras minúsculas como para letras
+ * maiúsculas.
+ *
+ *
+ * @param value
+ * String com os caracteres a serem removidos.
+ * @return String sem acentuação.
+ * @since 0.2
+ */
+ public static String eliminateAccent(final String value) {
+
+ String modifiedValue = value;
+
+ // Para ç e Ç
+ modifiedValue = replaceChars(modifiedValue, '\u00E7', 'c');
+ modifiedValue = replaceChars(modifiedValue, '\u00C7', 'C');
+
+ // Para à, á, â, ã e ä
+ modifiedValue = replaceChars(modifiedValue, '\u00E0', 'a');
+ modifiedValue = replaceChars(modifiedValue, '\u00E1', 'a');
+ modifiedValue = replaceChars(modifiedValue, '\u00E2', 'a');
+ modifiedValue = replaceChars(modifiedValue, '\u00E3', 'a');
+ modifiedValue = replaceChars(modifiedValue, '\u00E4', 'a');
+
+ // Para è, é, ê e ë
+ modifiedValue = replaceChars(modifiedValue, '\u00E8', 'e');
+ modifiedValue = replaceChars(modifiedValue, '\u00E9', 'e');
+ modifiedValue = replaceChars(modifiedValue, '\u00EA', 'e');
+ modifiedValue = replaceChars(modifiedValue, '\u00EB', 'e');
+
+ // Para ì, í, î e ï
+ modifiedValue = replaceChars(modifiedValue, '\u00EC', 'i');
+ modifiedValue = replaceChars(modifiedValue, '\u00ED', 'i');
+ modifiedValue = replaceChars(modifiedValue, '\u00EE', 'i');
+ modifiedValue = replaceChars(modifiedValue, '\u00EF', 'i');
+
+ // Para ò, ó, ô, õ e ö
+ modifiedValue = replaceChars(modifiedValue, '\u00F2', 'o');
+ modifiedValue = replaceChars(modifiedValue, '\u00F3', 'o');
+ modifiedValue = replaceChars(modifiedValue, '\u00F4', 'o');
+ modifiedValue = replaceChars(modifiedValue, '\u00F5', 'o');
+ modifiedValue = replaceChars(modifiedValue, '\u00F6', 'o');
+
+ // Para ù, ú, û e ü
+ modifiedValue = replaceChars(modifiedValue, '\u00F9', 'u');
+ modifiedValue = replaceChars(modifiedValue, '\u00FA', 'u');
+ modifiedValue = replaceChars(modifiedValue, '\u00FB', 'u');
+ modifiedValue = replaceChars(modifiedValue, '\u00FC', 'u');
+
+ // Para À, Á, Â, Ã e Ä
+ modifiedValue = replaceChars(modifiedValue, '\u00C0', 'A');
+ modifiedValue = replaceChars(modifiedValue, '\u00C1', 'A');
+ modifiedValue = replaceChars(modifiedValue, '\u00C2', 'A');
+ modifiedValue = replaceChars(modifiedValue, '\u00C3', 'A');
+ modifiedValue = replaceChars(modifiedValue, '\u00C4', 'A');
+
+ // Para È, É, Ê e Ë
+ modifiedValue = replaceChars(modifiedValue, '\u00C8', 'E');
+ modifiedValue = replaceChars(modifiedValue, '\u00C9', 'E');
+ modifiedValue = replaceChars(modifiedValue, '\u00CA', 'E');
+ modifiedValue = replaceChars(modifiedValue, '\u00CB', 'E');
+
+ // Para Ì, Í, Î e Ï
+ modifiedValue = replaceChars(modifiedValue, '\u00CC', 'I');
+ modifiedValue = replaceChars(modifiedValue, '\u00CD', 'I');
+ modifiedValue = replaceChars(modifiedValue, '\u00CE', 'I');
+ modifiedValue = replaceChars(modifiedValue, '\u00CF', 'I');
+
+ // Para Ò, Ó, Ô, Õ e Ö
+ modifiedValue = replaceChars(modifiedValue, '\u00D2', 'O');
+ modifiedValue = replaceChars(modifiedValue, '\u00D3', 'O');
+ modifiedValue = replaceChars(modifiedValue, '\u00D4', 'O');
+ modifiedValue = replaceChars(modifiedValue, '\u00D5', 'O');
+ modifiedValue = replaceChars(modifiedValue, '\u00D6', 'O');
+
+ // Para Ù, Ú, Û e Ü
+ modifiedValue = replaceChars(modifiedValue, '\u00D9', 'U');
+ modifiedValue = replaceChars(modifiedValue, '\u00DA', 'U');
+ modifiedValue = replaceChars(modifiedValue, '\u00DB', 'U');
+ modifiedValue = replaceChars(modifiedValue, '\u00DC', 'U');
+
+ return modifiedValue;
+ }
+
+ /**
+ * Verifica se a String passada por parâmetro não é
+ * null e não é numérica, ou seja, se a string não contém
+ * somente dígitos unicode.
+ *
+ * Lança exceção, com a mensagem passada por parâmetro (segundo parâmetro
+ * String), caso não preencha estes requisitos.
+ *
+ *
+ * @param value
+ * - String analisada
+ *
+ * @param message
+ * - Mensagem utiliada na exceção.
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string não seja numérica.
+ *
+ * @since 0.2
+ */
+ public static void checkNotNumeric(String value, String message) {
+
+ checkNotNumeric(value, message, message);
+ }
+
+ /**
+ * Verifica se a String passada por parâmetro não é
+ * null e não é numérica, ou seja, se a string não contém
+ * somente dígitos unicode.
+ *
+ * Lança exceção, com a mensagem passada por parâmetro (segundo parâmetro
+ * String), caso não preencha estes requisitos.
+ *
+ *
+ * @param value
+ * - String analisada
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string não seja numérica.
+ *
+ * @since 0.2
+ */
+ public static void checkNotNumeric(String value) {
+
+ checkNotNumeric(value, "String nula!", format(
+ "Valor inválido. String [\"%s\"] não numérica!", value));
+ }
+
+ /**
+ * Verifica se a String passada por parâmetro não é
+ * null, não é vazia (EMPTY) e não possui apenas
+ * espaços em branco.
+ *
+ * Lança exceção, com a mensagem passada por parâmetro (segundo parâmetro
+ * String), caso não preencha estes requisitos.
+ *
+ *
+ * @param value
+ * - String analisada
+ *
+ * @param message
+ * - Mensagem utiliada na exceção.
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string seja vazia.
+ *
+ * @since 0.2
+ */
+ public static void checkNotBlank(String value, String message) {
+
+ checkNotBlank(value, message, message);
+ }
+
+ /**
+ * Verifica se a String passada por parâmetro não é
+ * null, não é vazia (EMPTY) e não possui apenas
+ * espaços em branco. Lança exceção caso não preencha estes requisitos.
+ *
+ * @param value
+ * - String analisada
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string seja vazia.
+ *
+ * @since 0.2
+ */
+ public static void checkNotBlank(String value) {
+
+ checkNotBlank(
+ value,
+ "String nula!",
+ format(
+ "Valor inválido. String [\"%s\"] vazia ou contendo somente espaços em branco!",
+ value));
+ }
+
+ /**
+ * Retorna uma dado valor padrão quando a string informada for considerada
+ * como blank por {@linkplain StringUtils#isBlank(String)}.
+ *
+ *
+ *
+ * @param str
+ * String a testar e ser usada como valor de retorno se não for
+ * blank, pode ser null
+ * @param defaultValue
+ * - O valor padrão retornado caso a string testada seja blank,
+ * pode ser null
+ * @return String - Se não for blank, caso contrário
+ * defaultValue
+ *
+ * @since 0.2
+ */
+ public static String whenBlank(String str, String defaultValue) {
+
+ return (isNotBlank(str) ? str : defaultValue);
+ }
+
+ /**
+ * Método privado para fins de reutilização de código.
+ *
+ * Verifica se a String passada por parâmetro não é
+ * null e não é numérica, ou seja, se a string não contém
+ * somente dígitos unicode.
+ *
+ *
+ * Lança IllegalArgumentException, com a mensagem definida em
+ * messageNullPointer (segundo parâmetro String), caso o valor
+ * passado seja null
+ *
+ *
+ * Lança IllegalArgumentException, com a mensagem definida em
+ * messageIllegalArgument (terceiro parâmetro String), caso o
+ * valor passado não seja numérico.
+ *
+ *
+ * @param value
+ * - String analisada
+ *
+ * @param messageNullPointer
+ * - Mensagem utiliada na exceção.
+ *
+ * @param messageIllegalArgument
+ * - Mensagem utiliada na exceção.
+ *
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string não seja numérica.
+ *
+ * @since 0.2
+ */
+ private static void checkNotNumeric(String value,
+ String messageNullPointer, String messageIllegalArgument) {
+
+ Objects.checkNotNull(value, messageNullPointer);
+
+ if (!isNumeric(value)) {
+ Exceptions.throwIllegalArgumentException(messageIllegalArgument);
+ }
+ }
+
+ /**
+ * Método privado para fins de reutilização de código.
+ *
+ * Verifica se a String passada por parâmetro não é
+ * null, não é vazia (StringUtils.EMPTY) e não
+ * possui apenas espaços em branco.
+ *
+ *
+ * Lança IllegalArgumentException, com a mensagem definida em
+ * messageNullPointer (segundo parâmetro String), caso o valor
+ * passado seja null
+ *
+ *
+ * Lança IllegalArgumentException, com a mensagem definida em
+ * messageIllegalArgument (terceiro parâmetro String), caso o
+ * valor passado seja vazio.
+ *
+ *
+ * @param value
+ * - String analisada
+ *
+ * @param messageNullPointer
+ * - Mensagem utiliada na exceção.
+ *
+ * @param messageIllegalArgument
+ * - Mensagem utiliada na exceção.
+ *
+ * @throws IllegalArgumentException - Caso a string seja null ou
+ * caso a string seja vazia.
+ *
+ * @since 0.2
+ */
+ private static void checkNotBlank(String value, String messageNullPointer,
+ String messageIllegalArgument) {
+
+ Objects.checkNotNull(value, messageNullPointer);
+
+ if (isBlank(value)) {
+ Exceptions.throwIllegalArgumentException(messageIllegalArgument);
+ }
+ }
+
+ /**
+ * Retorna uma string de tamanho informado {@code length} com o
+ * preenchimento de zeros à esquerda para o número informado.
+ *
+ * @param numberToFill
+ * Número a ser transformado em string com zeros à esquerda
+ * @param length
+ * Tamanho final da string com zeros à esquerda
+ * @return string com zeros a esquerda
+ */
+ public static String fillWithZeroLeft(int numberToFill, int length){
+ return fillWithZeroLeft(String.valueOf(numberToFill), length);
+ }
+
+ /**
+ * Retorna uma string de tamanho informado {@code length} com o
+ * preenchimento de zeros à esquerda para o número informado.
+ *
+ * @param numberToFill
+ * Número a ser transformado em string com zeros à esquerda
+ * @param length
+ * Tamanho final da string com zeros à esquerda
+ * @return string com zeros a esquerda
+ */
+ public static String fillWithZeroLeft(long numberToFill, int length){
+ return fillWithZeroLeft(String.valueOf(numberToFill), length);
+ }
+
+ /**
+ * Retorna uma string de tamanho informado {@code length} com o
+ * preenchimento de zeros à esquerda para a string informada.
+ *
+ * @param stringToFill
+ * String a ser preenchida com zeros à esquerda
+ * @param length
+ * Tamanho final da string com zeros à esquerda
+ * @return string com zeros a esquerda
+ */
+ public static String fillWithZeroLeft(String stringToFill, int length){
+ return leftPad(stringToFill, length, "0");
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalFormat.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalFormat.java
new file mode 100644
index 0000000..2dd81cb
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalFormat.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 17:31:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 17:31:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+import org.jrimum.utilix.Objects;
+
+/**
+ *
+ * Abstração para o uso de formatadores thread-safe em enumerações.
+ *
+ *
+ * @author Gilmar P.S.L.
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public abstract class ThreadLocalFormat extends ThreadLocal {
+
+ protected final String format;
+
+ protected ThreadLocalFormat(String format) {
+
+ Objects.checkNotNull(format, "INVALID NULL FORMAT!");
+
+ this.format = format;
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalLocalizedFormat.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalLocalizedFormat.java
new file mode 100644
index 0000000..4d15932
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/ThreadLocalLocalizedFormat.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 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: 01/08/2010 - 21:30:00
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 01/08/2010 - 21:30:00
+ *
+ */
+
+package org.jrimum.utilix.text;
+
+import java.util.Locale;
+
+import org.jrimum.utilix.Objects;
+
+/**
+ *
+ * Abstração para o uso de formatadores thread-safe com o uso de "localização"
+ * em enumerações.
+ *
+ *
+ * @author Gilmar P.S.L.
+ *
+ * @since 0.2
+ *
+ * @version 0.2
+ */
+public abstract class ThreadLocalLocalizedFormat extends ThreadLocalFormat {
+
+ protected final Locale locale;
+ protected final S formatSymbols;
+
+ protected ThreadLocalLocalizedFormat(String format, Locale locale) {
+
+ super(format);
+
+ Objects.checkNotNull(locale, "INVALID NULL LOCALE!");
+
+ this.locale = locale;
+ this.formatSymbols = null;
+ }
+
+ protected ThreadLocalLocalizedFormat(String format, S formatSymbols) {
+
+ super(format);
+
+ Objects.checkNotNull(formatSymbols, "INVALID NULL FORMAT SYMBOLS!");
+
+ this.formatSymbols = formatSymbols;
+ this.locale = null;
+ }
+
+ protected ThreadLocalLocalizedFormat(String format, Locale locale,
+ S formatSymbols) {
+
+ super(format);
+
+ Objects.checkNotNull(locale, "INVALID NULL LOCALE!");
+ Objects.checkNotNull(formatSymbols, "INVALID NULL FORMAT SYMBOLS!");
+
+ this.formatSymbols = formatSymbols;
+ this.locale = locale;
+ }
+}
diff --git a/jrimum-utilix/src/main/java/org/jrimum/utilix/text/package-info.java b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/package-info.java
new file mode 100644
index 0000000..a19b2f0
--- /dev/null
+++ b/jrimum-utilix/src/main/java/org/jrimum/utilix/text/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010 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: 15/08/2010 - 15:37:49
+ *
+ * ================================================================================
+ *
+ * Direitos autorais 2010 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: 15/08/2010 - 15:37:49
+ *
+ */
+
+/**
+ * Classes relacionadas a manipulação, extração, composição e formatação de textos.
+ *
+ * @author Gilmar P.S.L
+ */
+package org.jrimum.utilix.text;
\ No newline at end of file
diff --git a/jrimum-utilix/src/test/java/org/jrimum/utilix/TestCollections.java b/jrimum-utilix/src/test/java/org/jrimum/utilix/TestCollections.java
new file mode 100644
index 0000000..6ce3fc0
--- /dev/null
+++ b/jrimum-utilix/src/test/java/org/jrimum/utilix/TestCollections.java
@@ -0,0 +1,230 @@
+/*
+ * 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: 31/07/2010 - 23:04:41
+ */
+
+package org.jrimum.utilix;
+
+import static java.util.Collections.EMPTY_LIST;
+import static java.util.Collections.EMPTY_MAP;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+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 TestCollections {
+
+ private static final Object EMPTY_OBJECT = new Object();
+
+ private static final Map