Java tutorial
/* * 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:08:25 * * ================================================================================ * * Direitos autorais 2008 JRimum Project * * Licenciado sob a Licena Apache, Verso 2.0 ("LICENA"); voc no pode usar * esse arquivo exceto em conformidade com a esta LICENA. Voc pode obter uma * cpia desta LICENA em http://www.apache.org/licenses/LICENSE-2.0 A menos que * haja exigncia legal ou acordo por escrito, a distribuio de software sob * esta LICENA se dar COMO EST??, SEM GARANTIAS OU CONDIES DE QUALQUER * TIPO, sejam expressas ou tcitas. Veja a LICENA para a redao especfica a * reger permisses e limitaes sob esta LICENA. * * Criado em: 30/03/2008 - 18:08:25 * */ package br.com.nordestefomento.jrimum.bopepo.campolivre; import static br.com.nordestefomento.jrimum.utilix.ObjectUtil.isNull; import org.apache.commons.lang.StringUtils; import br.com.nordestefomento.jrimum.domkee.financeiro.banco.febraban.Titulo; abstract class AbstractCLCaixaEconomicaFederal extends AbstractCampoLivre { /** * */ private static final long serialVersionUID = -4104858478390595830L; private static final int NOSSO_NUMERO_SINCO = 17; protected AbstractCLCaixaEconomicaFederal(Integer fieldsLength, Integer stringLength) { super(fieldsLength, stringLength); } static CampoLivre create(Titulo titulo) throws NotSupportedCampoLivreException { CampoLivre campoLivre = null; String nossoNumero = titulo.getNossoNumero(); if (StringUtils.isNotBlank(nossoNumero)) { switch (nossoNumero.length()) { case NOSSO_NUMERO_SINCO: campoLivre = new CLCaixaEconomicaFederalSINCO(titulo); break; } } if (isNull(campoLivre)) { throw new NotSupportedCampoLivreException("Campo livre disponvel somente para ttulos com " + " comprimento de " + NOSSO_NUMERO_SINCO + " " + "(SINCO) caracteres"); } else { return campoLivre; } } }