
org.nuiton.validator.NuitonValidatorModel Maven / Gradle / Ivy
The newest version!
/*
* #%L
* Validation :: API
* %%
* Copyright (C) 2021 - 2024 Ultreia.io
* %%
* This program 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.
*
* This program 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
* .
* #L%
*/
package org.nuiton.validator;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
/**
* Represents the model of a {@link NuitonValidator}.
*
* This model describing properties of a validator :
*
* - {@link #type} : the type of object which can be validated by the validator
* - {@link #context} : the context of validation, if no context is required then the context is {@code null}.
*
- {@link #scopes} : the scopes of validation (see {@link NuitonValidatorScope})
* - {@link #fields} : the fields that can be validated by the validator
*
*
* @author Tony Chemit - [email protected]
* @since 2.0
*/
public class NuitonValidatorModel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Type of object to validate
*/
protected Class type;
/**
* Context of validation (can be {@code null}, for no context).
*/
protected String context;
/**
* Set of scopes that can be validated for the type and context
*/
protected Set scopes;
/**
* Set of fields that can be validated for the type and context
*/
protected Map fields;
public NuitonValidatorModel(Class type,
String context,
Set scopes,
Map fields) {
this.type = type;
this.context = context;
this.scopes = Collections.unmodifiableSet(scopes);
this.fields = Collections.unmodifiableMap(fields);
}
public Class getType() {
return type;
}
public String getContext() {
return context;
}
public Set getScopes() {
return scopes;
}
public Map getFields() {
return fields;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy