Package br.net.woodstock.rockframework.domain.validator.hibernate

Source Code of br.net.woodstock.rockframework.domain.validator.hibernate.ReferenceValidator

/*
* This file is part of rockframework.
*
* rockframework is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* rockframework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>;.
*/
package br.net.woodstock.rockframework.domain.validator.hibernate;

import br.net.woodstock.rockframework.domain.Entity;

public class ReferenceValidator extends AbstractValidator<Reference> {

  @Override
  @SuppressWarnings("rawtypes")
  public boolean isValid(final Object o) {
    if (o == null) {
      return true;
    }
    if (o instanceof Entity) {
      Entity e = (Entity) o;
      Object id = e.getId();
      if (id != null) {
        return true;
      }
      return false;
    }
    return false;
  }

}
TOP

Related Classes of br.net.woodstock.rockframework.domain.validator.hibernate.ReferenceValidator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.