Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* 
  * Copyright (C) 2012 FoxLabs
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.foxlabs.validation;
The root interface in the validation hierarchy. Validation is an abstract component that allows somehow validate values and may generate ViolationException if validation fails.

Validation implementations should be immutable.

Parameters:
<V> The type of value to be validated
Author(s):
Fox Mulder
See also:
ValidationContext
public interface Validation<V> {
    
    
Returns the type of value to be validated.

Returns:
The type of value to be validated.
    Class<?> getType();
    
    
Returns localized error message template.

Note that this method may return null.

Parameters:
context Validation context.
Returns:
Localized error message template.
    String getMessageTemplate(ValidationContext<?> context);
    
    
Determines if error message template returned by the method getMessageTemplate(org.foxlabs.validation.ValidationContext) needs to be rendered and appends arguments to be substituted into the error message template.

Parameters:
context Validation context.
arguments Arguments to be substituted into the error message template.
Returns:
true if error message template needs to be rendered; false otherwise.
    boolean appendMessageArguments(ValidationContext<?> contextMap<StringObjectarguments);
    
New to GrepCode? Check out our FAQ X