@Test public void testCheckInCompatibility() throws Exception { assertTrue(SxpBindingFilter.checkInCompatibility(getAclFilter(FilterType.Inbound), getAclFilter(FilterType.Inbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getAclFilter(FilterType.Inbound), getAclFilter(FilterType.Outbound))); assertTrue(SxpBindingFilter.checkInCompatibility(getPrefixListFilter(FilterType.Inbound), getAclFilter(FilterType.Inbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getPrefixListFilter(FilterType.Inbound), getAclFilter(FilterType.Outbound))); assertTrue(SxpBindingFilter.checkInCompatibility(getPrefixListFilter(FilterType.Inbound), getAclFilter(FilterType.Inbound))); assertTrue(SxpBindingFilter.checkInCompatibility(getAclFilter(FilterType.Inbound), getPrefixListFilter(FilterType.Inbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getPrefixListFilter(FilterType.Inbound), getAclFilter(FilterType.Outbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getAclFilter(FilterType.Inbound), getPrefixListFilter(FilterType.Outbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getPeerSequenceFilter(FilterType.Inbound), getAclFilter(FilterType.Inbound))); assertFalse(SxpBindingFilter.checkInCompatibility(getPeerSequenceFilter(FilterType.Inbound), getPrefixListFilter(FilterType.Inbound))); SxpFilter aclFilter = getAclFilter(FilterType.Inbound); assertFalse(SxpBindingFilter.checkInCompatibility(null, aclFilter)); assertFalse(SxpBindingFilter.checkInCompatibility(aclFilter, null)); assertTrue(SxpBindingFilter.checkInCompatibility(aclFilter, aclFilter)); }
public static <F extends SxpFilterFields> boolean checkInCompatibility(F filter1, F filter2) { if (filter1 == null || filter2 == null) { return false; } if (filter1 == filter2) { return true; } if (!Preconditions.checkNotNull(filter1.getFilterType()).equals(filter2.getFilterType())) { return false; } return Preconditions.checkNotNull(filter1.getFilterEntries()) .getClass() .equals(Preconditions.checkNotNull(filter2.getFilterEntries()).getClass()) || filter1.getFilterEntries() instanceof AclFilterEntries && filter2.getFilterEntries() instanceof PrefixListFilterEntries || filter1.getFilterEntries() instanceof PrefixListFilterEntries && filter2.getFilterEntries() instanceof AclFilterEntries || filter1.getFilterEntries() instanceof PeerSequenceFilterEntries && filter2.getFilterEntries() instanceof PeerSequenceFilterEntries; }
SxpBindingFilter implements Function<SxpBindingFields, Boolean>, Predicate<SxpBindingFields> { public static <F extends SxpFilterFields> boolean checkInCompatibility(F filter1, F filter2) { if (filter1 == null || filter2 == null) { return false; } if (filter1 == filter2) { return true; } if (!Preconditions.checkNotNull(filter1.getFilterType()).equals(filter2.getFilterType())) { return false; } return Preconditions.checkNotNull(filter1.getFilterEntries()) .getClass() .equals(Preconditions.checkNotNull(filter2.getFilterEntries()).getClass()) || filter1.getFilterEntries() instanceof AclFilterEntries && filter2.getFilterEntries() instanceof PrefixListFilterEntries || filter1.getFilterEntries() instanceof PrefixListFilterEntries && filter2.getFilterEntries() instanceof AclFilterEntries || filter1.getFilterEntries() instanceof PeerSequenceFilterEntries && filter2.getFilterEntries() instanceof PeerSequenceFilterEntries; } }
SxpBindingFilter implements Function<SxpBindingFields, Boolean>, Predicate<SxpBindingFields> { public static <F extends SxpFilterFields> boolean checkInCompatibility(F filter1, F filter2) { if (filter1 == null || filter2 == null) { return false; } if (filter1 == filter2) { return true; } if (!Preconditions.checkNotNull(filter1.getFilterType()).equals(filter2.getFilterType())) { return false; } return Preconditions.checkNotNull(filter1.getFilterEntries()) .getClass() .equals(Preconditions.checkNotNull(filter2.getFilterEntries()).getClass()) || filter1.getFilterEntries() instanceof AclFilterEntries && filter2.getFilterEntries() instanceof PrefixListFilterEntries || filter1.getFilterEntries() instanceof PrefixListFilterEntries && filter2.getFilterEntries() instanceof AclFilterEntries || filter1.getFilterEntries() instanceof PeerSequenceFilterEntries && filter2.getFilterEntries() instanceof PeerSequenceFilterEntries; } private  SxpBindingFilter(String identifier); protected  SxpBindingFilter(R filter, String identifier); }
SxpBindingFilter implements Function<SxpBindingFields, Boolean>, Predicate<SxpBindingFields> { public static <F extends SxpFilterFields> boolean checkInCompatibility(F filter1, F filter2) { if (filter1 == null || filter2 == null) { return false; } if (filter1 == filter2) { return true; } if (!Preconditions.checkNotNull(filter1.getFilterType()).equals(filter2.getFilterType())) { return false; } return Preconditions.checkNotNull(filter1.getFilterEntries()) .getClass() .equals(Preconditions.checkNotNull(filter2.getFilterEntries()).getClass()) || filter1.getFilterEntries() instanceof AclFilterEntries && filter2.getFilterEntries() instanceof PrefixListFilterEntries || filter1.getFilterEntries() instanceof PrefixListFilterEntries && filter2.getFilterEntries() instanceof AclFilterEntries || filter1.getFilterEntries() instanceof PeerSequenceFilterEntries && filter2.getFilterEntries() instanceof PeerSequenceFilterEntries; } private  SxpBindingFilter(String identifier); protected  SxpBindingFilter(R filter, String identifier); R getSxpFilter(); String getIdentifier(); @Override Boolean apply(SxpBindingFields binding); @Override boolean test(SxpBindingFields binding); static SxpBindingFilter<?, ? extends SxpFilterFields> generateFilter(T filter,
            String peerGroupName); static SxpBindingFilter<?, ? extends SxpDomainFilterFields> generateFilter(
            T filter, String domainName); @Override boolean equals(Object o); @Override int hashCode(); static SxpBindingFilter<?, ? extends SxpFilterFields> mergeFilters(
            final Collection<SxpBindingFilter<?, ? extends SxpFilterFields>> values); static boolean checkInCompatibility(F filter1, F filter2); static SxpBindingFilter<?, ? extends SxpDomainFilterFields> mergeFilters(
            List<SxpBindingFilter<?, ? extends SxpDomainFilterFields>> values); }
SxpBindingFilter implements Function<SxpBindingFields, Boolean>, Predicate<SxpBindingFields> { public static <F extends SxpFilterFields> boolean checkInCompatibility(F filter1, F filter2) { if (filter1 == null || filter2 == null) { return false; } if (filter1 == filter2) { return true; } if (!Preconditions.checkNotNull(filter1.getFilterType()).equals(filter2.getFilterType())) { return false; } return Preconditions.checkNotNull(filter1.getFilterEntries()) .getClass() .equals(Preconditions.checkNotNull(filter2.getFilterEntries()).getClass()) || filter1.getFilterEntries() instanceof AclFilterEntries && filter2.getFilterEntries() instanceof PrefixListFilterEntries || filter1.getFilterEntries() instanceof PrefixListFilterEntries && filter2.getFilterEntries() instanceof AclFilterEntries || filter1.getFilterEntries() instanceof PeerSequenceFilterEntries && filter2.getFilterEntries() instanceof PeerSequenceFilterEntries; } private  SxpBindingFilter(String identifier); protected  SxpBindingFilter(R filter, String identifier); R getSxpFilter(); String getIdentifier(); @Override Boolean apply(SxpBindingFields binding); @Override boolean test(SxpBindingFields binding); static SxpBindingFilter<?, ? extends SxpFilterFields> generateFilter(T filter,
            String peerGroupName); static SxpBindingFilter<?, ? extends SxpDomainFilterFields> generateFilter(
            T filter, String domainName); @Override boolean equals(Object o); @Override int hashCode(); static SxpBindingFilter<?, ? extends SxpFilterFields> mergeFilters(
            final Collection<SxpBindingFilter<?, ? extends SxpFilterFields>> values); static boolean checkInCompatibility(F filter1, F filter2); static SxpBindingFilter<?, ? extends SxpDomainFilterFields> mergeFilters(
            List<SxpBindingFilter<?, ? extends SxpDomainFilterFields>> values);  }