com.brightsparklabs.asanti.validator.builtin.Iso646StringValidator 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#Iso646String}
*
* @author brightSPARK Labs
*/
public class Iso646StringValidator extends PrimitiveBuiltinTypeValidator {
// -------------------------------------------------------------------------
// INSTANCE VARIABLES
// -------------------------------------------------------------------------
/** singleton instance */
private static Iso646StringValidator instance;
// -------------------------------------------------------------------------
// CONSTRUCTION
// -------------------------------------------------------------------------
/**
* Default constructor.
*
* This is private, use {@link #getInstance()} to obtain an instance
*/
private Iso646StringValidator() {}
/**
* Returns a singleton instance of this class
*
* @return a singleton instance of this class
*/
public static Iso646StringValidator getInstance() {
if (instance == null) {
instance = new Iso646StringValidator();
}
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);
}
}