001/* 
002 * JKNIV ,
003 * Copyright (C) 2017, the original author or authors.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either
008 * version 2.1 of the License.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public
016 * License along with this library; if not, write to the Free Software Foundation, Inc., 
017 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
018 */
019
020package net.sf.jkniv.asserts;
021
022public class AssertsFactory
023{
024    private static Assertable isNull;
025    private static Assertable notNull;
026    private static Assertable notEmpty;
027    private static Assertable isTrue;
028    private static Assertable instanceOf;
029
030    public static Assertable getIsNull()
031    {
032        if (isNull == null)
033            isNull = new IsNull();
034        
035        return isNull;
036    }
037    
038    public static Assertable getIsTrue()
039    {
040        if (isTrue == null)
041            isTrue = new IsTrue();
042        
043        return isTrue;
044    }
045    
046    
047    public static Assertable getNotNull()
048    {
049        if (notNull == null)
050            notNull = new NotNull();
051        
052        return notNull;
053    }
054    
055    public static Assertable getNotEmpty()
056    {
057        if (notEmpty == null)
058            notEmpty = new NotEmpty();
059        
060        return notEmpty;
061    }
062
063    public static Assertable getInstanceOf()
064    {
065        if (instanceOf == null)
066            instanceOf = new InstanceOf();
067        
068        return instanceOf;
069    }
070
071    public static Assertable newIsNull(String message)
072    {
073        return new IsNull(message);
074    }
075
076    public static Assertable newNotNull(String message)
077    {
078        return new NotNull(message);
079    }
080
081    public static Assertable newIsTrue(String message)
082    {
083        return new IsTrue(message);
084    }
085
086    public static Assertable newNotEmpty(String message)
087    {
088        return new NotEmpty(message);
089    }
090
091    public static Assertable newInstanceOf(String message)
092    {
093        return new InstanceOf(message);
094    }
095
096}