brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Feature: catalog item disabled
Date Thu, 20 Aug 2015 20:38:05 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/850#discussion_r37578177
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/catalog/CatalogPredicates.java ---
    @@ -94,49 +165,119 @@ public boolean apply(@Nullable CatalogItem<T,SpecT> item)
{
         }
     
         public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> symbolicName(final
Predicate<? super String> filter) {
    -        return new Predicate<CatalogItem<T,SpecT>>() {
    +        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in
persisted state
    +        new Predicate<CatalogItem<T,SpecT>>() {
                 @Override
                 public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
                     return (item != null) && filter.apply(item.getSymbolicName());
                 }
             };
    +        return new SymbolicNameMatches<T,SpecT>(filter);
    +    }
    +    
    +    private static class SymbolicNameMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>>
{
    +        private final Predicate<? super String> filter;
    +        
    +        public SymbolicNameMatches(Predicate<? super String> filter) {
    +            this.filter = filter;
    +        }
    +        @Override
    +        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
    +            return (item != null) && filter.apply(item.getSymbolicName());
    +        }
         }
     
         public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> javaType(final
Predicate<? super String> filter) {
    -        return new Predicate<CatalogItem<T,SpecT>>() {
    +        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in
persisted state
    +        new Predicate<CatalogItem<T,SpecT>>() {
                 @Override
                 public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
                     return (item != null) && filter.apply(item.getJavaType());
                 }
             };
    +        return new JavaTypeMatches<T, SpecT>(filter);
    +    }
    +    
    +    private static class JavaTypeMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>>
{
    +        private final Predicate<? super String> filter;
    +        
    +        public JavaTypeMatches(Predicate<? super String> filter) {
    +            this.filter = filter;
    +        }
    +        @Override
    +        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
    +            return (item != null) && filter.apply(item.getJavaType());
    +        }
         }
     
         public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> xml(final
Predicate<? super String> filter) {
    -        return new Predicate<CatalogItem<T,SpecT>>() {
    +        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in
persisted state
    +        new Predicate<CatalogItem<T,SpecT>>() {
                 @Override
                 public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
                     return (item != null) && filter.apply(item.toXmlString());
                 }
             };
    +        return new XmlMatches<T,SpecT>(filter);
    +    }
    +    
    +    private static class XmlMatches<T,SpecT> implements Predicate<CatalogItem<T,SpecT>>
{
    +        private final Predicate<? super String> filter;
    +        
    +        public XmlMatches(Predicate<? super String> filter) {
    +            this.filter = filter;
    +        }
    +        @Override
    +        public boolean apply(@Nullable CatalogItem<T,SpecT> item) {
    +            return (item != null) && filter.apply(item.toXmlString());
    +        }
         }
     
         public static <T,SpecT> Predicate<CatalogItem<T,SpecT>> entitledToSee(final
ManagementContext mgmt) {
    -        return new Predicate<CatalogItem<T,SpecT>>() {
    +        // TODO PERSISTENCE WORKAROUND kept anonymous function in case referenced in
persisted state
    --- End diff --
    
    `@since`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message