statoolinfosweb/src/fr/devinsy/statoolinfos/checker/PropertyRule.java

149 lines
3 KiB
Java
Raw Normal View History

2020-10-17 17:57:10 +02:00
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* StatoolInfos 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.checker;
/**
* The Class PropertyRule.
*/
public class PropertyRule
{
public enum PropertyMode
{
MANDATORY,
WISHED,
OPTIONAL
}
private String path;
private String pattern;
private PropertyMode mode;
/**
* Instantiates a new property rule.
*
* @param path
* the path
* @param pattern
* the pattern
* @param mode
* the mode
*/
public PropertyRule(final String path, final String pattern, final PropertyMode mode)
{
this.path = path;
this.pattern = pattern;
this.mode = mode;
}
public PropertyMode getMode()
{
return this.mode;
}
public String getPath()
{
return this.path;
}
public String getPattern()
{
return this.pattern;
}
/**
* Checks if is mandatory.
*
* @return true, if is mandatory
*/
public boolean isMandatory()
{
boolean result;
if (this.mode == PropertyMode.MANDATORY)
{
result = true;
}
else
{
result = false;
}
//
return result;
}
/**
* Checks if is optional.
*
* @return true, if is optional
*/
public boolean isOptional()
{
boolean result;
if (this.mode == PropertyMode.OPTIONAL)
{
result = true;
}
else
{
result = false;
}
//
return result;
}
/**
* Checks if is wished.
*
* @return true, if is wished
*/
public boolean isWished()
{
boolean result;
if (this.mode == PropertyMode.WISHED)
{
result = true;
}
else
{
result = false;
}
//
return result;
}
public void setMode(final PropertyMode mode)
{
this.mode = mode;
}
public void setPath(final String path)
{
this.path = path;
}
public void setPattern(final String pattern)
{
this.pattern = pattern;
}
}