All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yodlee.api.model.annotations.AllowedContainerValidator Maven / Gradle / Ivy

There is a newer version: 1.0.29.beta1
Show newest version
/**
 * Copyright (c) 2019 Yodlee, Inc. All Rights Reserved.
 *
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */
package com.yodlee.api.model.annotations;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import com.yodlee.api.model.enums.Container;

public class AllowedContainerValidator implements ConstraintValidator {

	protected List containers;

	@Override
	public void initialize(AllowedContainer containers) {
		this.containers = Arrays.asList(containers.value());
	}

	@Override
	public boolean isValid(Container container, ConstraintValidatorContext constraintValidatorContext) {
		if (Objects.isNull(container)) {
			return true;
		}
		return containers.contains(container);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy