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

uk.gov.ida.saml.metadata.EntitiesDescriptorNamePredicate Maven / Gradle / Ivy

There is a newer version: 3.4.6-277
Show newest version
package uk.gov.ida.saml.metadata;

import com.google.common.base.Predicate;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
import org.opensaml.saml.saml2.metadata.EntityDescriptor;

public class EntitiesDescriptorNamePredicate implements Predicate {

    private final EntitiesDescriptorNameCriterion criterion;

    public EntitiesDescriptorNamePredicate(EntitiesDescriptorNameCriterion criterion) {
        this.criterion = criterion;
    }

    @Override
    public boolean apply(EntityDescriptor input) {
        XMLObject parent = input.getParent();
        if (parent == null || !(parent instanceof EntitiesDescriptor)) {
            return false;
        }
        String entitiesName = ((EntitiesDescriptor) parent).getName();
        return entitiesName != null && entitiesName.equals(criterion.getExpectedName());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy