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

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

Introduction

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

Prototype

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

Source Link

Document

Returns a predicate that always evaluates to false .

Usage

From source file:net.shibboleth.idp.session.impl.UpdateSessionWithSPSession.java

/** {@inheritDoc} */
@Override//from www .  j  av a  2 s.c om
protected void doInitialize() throws ComponentInitializationException {
    super.doInitialize();

    if (!getActivationCondition().equals(Predicates.alwaysFalse())) {
        if (sessionManager == null) {
            throw new ComponentInitializationException("SessionManager cannot be null");
        } else if (spSessionCreationStrategy == null) {
            throw new ComponentInitializationException("Session creation strategy cannot be null");
        }
    }
}

From source file:ratpack.server.internal.NettyHandlerAdapter.java

public NettyHandlerAdapter(Stopper stopper, Handler handler, LaunchConfig launchConfig) {
    this.handlers = new Handler[] { handler };
    this.return404 = Handlers.notFound();
    this.launchConfig = launchConfig;
    this.registry = buildBaseRegistry(stopper, launchConfig);
    this.addResponseTimeHeader = launchConfig.isTimeResponses();
    this.applicationConstants = new DefaultContext.ApplicationConstants(launchConfig,
            new DefaultRenderController());
    this.execController = launchConfig.getExecController();
    this.execControl = execController.getControl();

    if (launchConfig.isCompressResponses()) {
        ImmutableSet<String> blacklist = launchConfig.getCompressionMimeTypeBlackList();
        this.shouldCompress = new ShouldCompressPredicate(launchConfig.getCompressionMinSize(),
                launchConfig.getCompressionMimeTypeWhiteList(),
                blacklist.isEmpty() ? ActivationBackedMimeTypes.getDefaultExcludedMimeTypes() : blacklist);
    } else {/* w w  w. j a  v a 2  s  . com*/
        this.shouldCompress = Predicates.alwaysFalse();
    }
}

From source file:net.shibboleth.idp.session.impl.UpdateSessionWithAuthenticationResult.java

/** {@inheritDoc} */
@Override/* w  w  w. j  a v  a2  s .  c om*/
protected void doInitialize() throws ComponentInitializationException {
    super.doInitialize();

    if (!getActivationCondition().equals(Predicates.alwaysFalse()) && sessionManager == null) {
        throw new ComponentInitializationException("SessionManager cannot be null");
    }
}

From source file:org.elasticsearch.action.bulk.BulkShardProcessor.java

public BulkShardProcessor(ClusterService clusterService,
        TransportBulkCreateIndicesAction transportBulkCreateIndicesAction,
        IndexNameExpressionResolver indexNameExpressionResolver, final Settings settings,
        BulkRetryCoordinatorPool bulkRetryCoordinatorPool, final boolean autoCreateIndices, int bulkSize,
        BulkRequestBuilder<Request> requestBuilder, BulkRequestExecutor<Request> requestExecutor, UUID jobId) {
    this.bulkRetryCoordinatorPool = bulkRetryCoordinatorPool;
    this.clusterService = clusterService;
    this.autoCreateIndices = autoCreateIndices;
    this.bulkSize = bulkSize;
    this.jobId = jobId;
    this.createIndicesBulkSize = Math.min(bulkSize, MAX_CREATE_INDICES_BULK_SIZE);

    if (autoCreateIndices) {
        final AutoCreateIndex autoCreateIndex = new AutoCreateIndex(settings, indexNameExpressionResolver);
        shouldAutocreateIndexPredicate = new Predicate<String>() {
            @Override//from  w ww.  ja v  a2 s.  c o  m
            public boolean apply(@Nullable String input) {
                assert input != null;
                return autoCreateIndex.shouldAutoCreate(input, BulkShardProcessor.this.clusterService.state());
            }
        };
    } else {
        shouldAutocreateIndexPredicate = Predicates.alwaysFalse();
    }

    this.transportBulkCreateIndicesAction = transportBulkCreateIndicesAction;
    responses = new BitSet();
    result = SettableFuture.create();

    this.requestExecutor = requestExecutor;
    this.requestBuilder = requestBuilder;
}

From source file:com.pinterest.pinlater.commons.ostrich.StatTrackingEventListener.java

public StatTrackingEventListener setIgnoreExceptionPredicate(Predicate<Throwable> predicate) {
    if (predicate != null) {
        ignoreExceptionPredicate = predicate;
    } else {/*from   w w w. j a va  2 s .c  o  m*/
        LOG.error("Null ignoreExceptionPredicate! Replaced with Predicates.alwaysFalse()");
        ignoreExceptionPredicate = Predicates.alwaysFalse();
    }
    return this;
}

From source file:org.eclipse.sirius.diagram.ui.tools.api.layout.PinHelper.java

/**
 * Indicates if the given ddiagram is allowing pin/unpin.
 * //from w w  w  . j a va 2s. c om
 * @param diagram
 *            the diagram to inspect
 * @return true if the given ddiagram is allowing layouting mode, false
 *         otherwise
 */
private static Predicate<DDiagramElement> allowsPinUnpin(DDiagram diagram) {
    // default return value is true for non-Region element (for basic
    // DDiagram that are not handled
    // by any DiagramDescriptionProvider).
    Predicate<DDiagramElement> result = new Predicate<DDiagramElement>() {
        public boolean apply(DDiagramElement dde) {
            if (dde instanceof DDiagramElementContainer) {
                DDiagramElementContainerExperimentalQuery query = new DDiagramElementContainerExperimentalQuery(
                        (DDiagramElementContainer) dde);
                return !query.isRegion();
            }
            return true;
        }
    };

    // If an aird has been opened from the Package Explorer View, then
    // we return false as no diagram is associated to this editor
    if (diagram == null || diagram.getDescription() == null) {
        return Predicates.alwaysFalse();
    }

    // If diagram is not null, we search for a possible
    // DiagramDescriptionProvider handling this type of diagram
    for (final IDiagramTypeDescriptor diagramTypeDescriptor : DiagramTypeDescriptorRegistry.getInstance()
            .getAllDiagramTypeDescriptors()) {
        if (diagramTypeDescriptor.getDiagramDescriptionProvider()
                .handles(diagram.getDescription().eClass().getEPackage())) {
            // This DiagramDescriptionProvider may forbid pin/unpin actions.
            final IDiagramDescriptionProvider provider = diagramTypeDescriptor.getDiagramDescriptionProvider();
            result = new Predicate<DDiagramElement>() {
                @Override
                public boolean apply(DDiagramElement input) {
                    return provider.allowsPinUnpin(input);
                }
            };
            break;
        }
    }

    return result;
}

From source file:net.sourceforge.cilib.algorithm.AbstractAlgorithm.java

/**
 * Removes a stopping condition./* w  w w.j a va  2s .  c  om*/
 * @param stoppingCondition The {@link net.sourceforge.cilib.stoppingcondition.StoppingCondition}
 *        to be removed.
 */
@Override
public final void removeStoppingCondition(StoppingCondition<Algorithm> stoppingCondition) {
    stoppingConditions.remove(stoppingCondition);

    this.stoppingCondition = Predicates.alwaysFalse();
    for (StoppingCondition<Algorithm> condition : stoppingConditions) {
        this.stoppingCondition = Predicates.or(this.stoppingCondition, condition);
    }
}

From source file:com.google.dart.tools.ui.internal.typehierarchy.TypeHierarchyViewPart.java

private Control createTypeViewerControl(Composite parent) {
    typesViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    Tree tree = typesViewer.getTree();//from   www. j  av  a  2s . c o  m

    typesViewer.setContentProvider(new TypeHierarchyContentProvider());
    typesViewer.setLabelProvider(new HierarchyLabelProvider(Predicates.alwaysFalse()));
    // register "viewer" as selection provide for this view
    IViewSite site = getViewSite();
    site.setSelectionProvider(typesViewer);
    // configure actions
    actionGroups = new CompositeActionGroup(new ActionGroup[] { new OpenViewActionGroup(site),
            new RefactorActionGroup(site), new DartSearchActionGroup(site) });
    // configure actions
    {
        IActionBars actionBars = site.getActionBars();
        actionGroups.fillActionBars(actionBars);
    }
    // prepare context menu
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager m) {
            contextMenuAboutToShow(m);
        }
    });
    contextMenu = manager.createContextMenu(tree);
    tree.setMenu(contextMenu);

    typesViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection) {
                IStructuredSelection structuredSelection = (IStructuredSelection) selection;
                Object selectedElement = structuredSelection.getFirstElement();
                methodsViewer.setInputType(selectedElement);
            }
        }
    });
    typesViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {
            ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection) {
                fOpenAction.run((IStructuredSelection) selection);
            }
        }
    });
    return tree;
}

From source file:org.eclipse.wb.internal.core.xml.model.generic.FlowContainerFactory.java

private Predicate<Object> getRtlPredicate(String prefix, boolean def) {
    String rtlString = getParameter(prefix + ".rtl");
    if (rtlString == null) {
        return Predicates.alwaysFalse();
    }/*from   w ww . j  ava  2 s. c  om*/
    return new ExpressionPredicate<Object>(rtlString);
}

From source file:net.shibboleth.idp.session.impl.ProcessLogout.java

/** {@inheritDoc} */
@Override//from www .ja v a2s  .  c o m
protected void doInitialize() throws ComponentInitializationException {
    super.doInitialize();

    if (!getActivationCondition().equals(Predicates.alwaysFalse())) {
        if (sessionResolver == null) {
            throw new ComponentInitializationException("SessionResolver cannot be null");
        } else if (sessionManager == null) {
            throw new ComponentInitializationException("SessionManager cannot be null");
        }
    }
}