com.brightsparklabs.asanti.validator.builtin.CharacterStringValidator Maven / Gradle / Ivy
/*
* Maintained by brightSPARK Labs.
* www.brightsparklabs.com
*
* Refer to LICENSE at repository root for license details.
*/
package com.brightsparklabs.asanti.validator.builtin;
import com.brightsparklabs.asanti.schema.AsnBuiltinType;
import com.brightsparklabs.asanti.validator.failure.ByteValidationFailure;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.Set;
/**
* Validator for data of type {@link AsnBuiltinType#CharacterString}
*
* @author brightSPARK Labs
*/
public class CharacterStringValidator extends PrimitiveBuiltinTypeValidator {
// -------------------------------------------------------------------------
// INSTANCE VARIABLES
// -------------------------------------------------------------------------
/** singleton instance */
private static CharacterStringValidator instance;
// -------------------------------------------------------------------------
// CONSTRUCTION
// -------------------------------------------------------------------------
/**
* Default constructor.
*
* This is private, use {@link #getInstance()} to obtain an instance
*/
private CharacterStringValidator() {}
/**
* Returns a singleton instance of this class
*
* @return a singleton instance of this class
*/
public static CharacterStringValidator getInstance() {
if (instance == null) {
instance = new CharacterStringValidator();
}
return instance;
}
// -------------------------------------------------------------------------
// IMPLEMENTATION: PrimitiveBuiltinTypeValidator
// -------------------------------------------------------------------------
@Override
protected ImmutableSet validateNonNullBytes(final byte[] bytes) {
final Set failures = Sets.newHashSet();
// TODO: ASN-105 implement validation logic
return ImmutableSet.copyOf(failures);
}
}