Example usage for com.google.common.base Predicates notNull

List of usage examples for com.google.common.base Predicates notNull

Introduction

In this page you can find the example usage for com.google.common.base Predicates notNull.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> notNull() 

Source Link

Document

Returns a predicate that evaluates to true if the object reference being tested is not null.

Usage

From source file:org.eclipse.buildship.ui.launch.SelectionJavaElementResolver.java

@Override
protected Collection<IJavaElement> findJavaElements() {
    return FluentIterable.from(this.adaptables).transform(new Function<Object, IJavaElement>() {

        @Override//ww  w.  j  ava2  s  . co  m
        @SuppressWarnings({ "cast", "RedundantCast" })
        public IJavaElement apply(Object input) {
            return (IJavaElement) Platform.getAdapterManager().getAdapter(input, IJavaElement.class);
        }

    }).filter(Predicates.notNull()).toList();
}

From source file:org.robotframework.ide.eclipse.main.plugin.tableeditor.settings.SettingsEditorPageSelectionProvider.java

public SettingsEditorPageSelectionProvider(final ISettingsFormFragment... formFragments) {
    this.formFragments = newArrayList(Iterables.filter(Arrays.asList(formFragments), Predicates.notNull()));
    for (final ISettingsFormFragment formFragment : formFragments) {
        addFocusListener(formFragment);/*from ww  w. ja  v a  2 s .  c o m*/
    }
}

From source file:org.polarsys.reqcycle.types.impl.ExtensionPointReader.java

public Map<String, IType> read() {
    return Maps.uniqueIndex(Iterables.filter(Iterables.transform(
            Arrays.asList(//from w  w w. j a va 2s . c o m
                    Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID, EXT_ID)),
            new Conf2Type()), Predicates.notNull()), new Function<IType, String>() {
                public String apply(IType type) {
                    return type != null ? type.getId() : "";
                }
            });
}

From source file:com.example.ModelWithAnonymousClass.java

public ModelWithAnonymousClass() {
    images = FluentIterable.from(Arrays.asList("/image/1")).transform(new Function<String, String>() {
        @Override// www . j a  v  a 2 s.co m
        public String apply(String path) {
            return resourceResolver.getResource(path).getValueMap().get("property", String.class);
        }
    }).filter(Predicates.notNull()).toList();
}

From source file:net.sourceforge.fenixedu.domain.accessControl.DepartmentPresidentStrategy.java

@Override
public Set<User> getMembers() {
    return FluentIterable.from(Bennu.getInstance().getDepartmentsSet())
            .transform(new Function<Department, User>() {
                @Override/*from  w ww  .  j a va2  s .c o m*/
                public User apply(Department input) {
                    return input.getCurrentDepartmentPresident().getUser();
                }
            }).filter(Predicates.notNull()).toSet();
}

From source file:org.mayocat.shop.catalog.front.context.LocalesInfoWebDataSupplier.java

@Override
public void supply(Map<String, Object> data) {
    // Manage list of locales and corresponding links
    String path = context.getRequest().getCanonicalPath();
    Map<String, Map<String, String>> locales = Maps.newHashMap();
    GeneralSettings settings = context.getSettings(GeneralSettings.class);
    final Locale mainLocale = settings.getLocales().getMainLocale().getValue();
    locales.put(mainLocale.toLanguageTag(), buildLocale(mainLocale, path, true));
    List<Locale> alternativeLocales = FluentIterable.from(settings.getLocales().getOtherLocales().getValue())
            .filter(Predicates.notNull()).toList();
    if (!alternativeLocales.isEmpty()) {
        for (final Locale locale : alternativeLocales) {
            locales.put(locale.toLanguageTag(), buildLocale(locale, path, false));
        }/*from ww w . j  a  va 2 s.co  m*/
    }

    data.put("locales", locales);
    data.put("locale", buildLocale(context.getLocale(), path, mainLocale.equals(context.getLocale())));
    data.put("localePath", context.isAlternativeLocale() ? ("/" + context.getLocale().toLanguageTag()) : "");
    data.put("url", data.get("localePath") + path);
    data.put("canonicalUrl", path);
}

From source file:org.fenixedu.academic.domain.accessControl.ProfessorsGroup.java

@Override
public Set<User> getMembers() {
    return FluentIterable.from(Bennu.getInstance().getProfessorshipsSet())
            .transform(new Function<Professorship, User>() {
                @Override/*from ww  w  .j a  v a2s. com*/
                public User apply(Professorship input) {
                    return input.getPerson().getUser();
                }
            }).filter(Predicates.notNull()).toSet();
}

From source file:org.jclouds.vcloud.functions.OrgsForNames.java

@Override
public Iterable<Org> apply(Iterable<String> from) {
    return Iterables.filter(transform(from, new Function<String, Org>() {
        public Org apply(String from) {
            return aclient.getOrgApi().findOrgNamed(from);
        }/*from w w w . j  a v  a  2 s.c om*/
    }), Predicates.notNull());
}

From source file:com.technophobia.substeps.runner.runtime.PredicatedClassLocator.java

public Iterator<Class<?>> fromPath(final String path) {
    final File directory = new File(path);
    final Iterator<File> files = FileUtils.iterateFiles(directory, new String[] { "class" }, true);
    final Iterator<Class<?>> unsafeTransformedClasses = Iterators.transform(files, classLoader);

    return Iterators.filter(unsafeTransformedClasses, Predicates.and(Predicates.notNull(), predicate));
}

From source file:com.atlassian.jira.license.MultiLicenseStoreImpl.java

@Override
@Nonnull/*  w  w w .ja  v a2s .  com*/
public Iterable<String> retrieve() {
    if (licenseRolesAreEnabled()) {
        List<ProductLicense> list = entityEngine.selectFrom(PRODUCT_LICENSE).findAll().orderBy("id");

        if (!list.isEmpty()) {
            return copyOf(transform(filter(list, Predicates.notNull()), new Function<ProductLicense, String>() {
                public String apply(ProductLicense input) {
                    return input.getLicenseKey();
                }
            }));
        }
    }

    String fallback = jiraLicenseStore.retrieve();
    if (fallback != null)
        return ImmutableList.of(fallback);
    return ImmutableList.of();
}