statoolinfosweb/src/fr/devinsy/statoolinfos/core/PathProperty.java

82 lines
1.9 KiB
Java
Raw Normal View History

2020-09-13 01:28:27 +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.core;
import org.apache.commons.lang3.StringUtils;
/**
* The Class PathProperty.
*/
public class PathProperty
{
2020-09-13 02:10:28 +02:00
private String path;
private String value;
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
/**
* Instantiates a new path property.
*
* @param path
* the key
* @param value
* the value
*/
public PathProperty(final String path, final String value)
{
if (StringUtils.isAllBlank(path))
{
throw new IllegalArgumentException("Path is blank.");
}
else
{
this.path = path;
this.value = value;
}
}
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
public String getLeaf()
{
String result;
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
result = this.path.substring(this.path.lastIndexOf('.') + 1);
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
//
return result;
}
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
public String getPath()
{
return this.path;
}
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
public String getValue()
{
return this.value;
}
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
public void setPath(final String path)
{
this.path = path;
}
2020-09-13 01:28:27 +02:00
2020-09-13 02:10:28 +02:00
public void setValue(final String value)
{
this.value = value;
}
2020-09-13 01:28:27 +02:00
}