Package org.apache.felix.ipojo.manipulator.spi

Examples of org.apache.felix.ipojo.manipulator.spi.Predicate


    /**
     * Restrict to the given {@link ElementType}.
     * @param type expected {@link ElementType}
     */
    public static Predicate on(final ElementType type) {
        return new Predicate() {
            public boolean matches(BindingContext context) {
                return context.getElementType().equals(type);
            }
        };
    }
View Full Code Here


    /**
     * Always return {@literal true}.
     */
    public static Predicate alwaysTrue() {
        return new Predicate() {
            public boolean matches(BindingContext context) {
                return true;
            }
        };
    }
View Full Code Here

        // Optimization
        if (predicates.length == 1) {
            return predicates[0];
        }

        return new Predicate() {
            public boolean matches(BindingContext context) {

                for (Predicate predicate : predicates) {
                    // Quit with first failure
                    if (!predicate.matches(context)) {
View Full Code Here

        // Optimization
        if (predicates.size() == 1) {
            return predicates.iterator().next();
        }

        return new Predicate() {
            public boolean matches(BindingContext context) {

                for (Predicate predicate : predicates) {
                    // Quit with first success
                    if (predicate.matches(context)) {
View Full Code Here

        /**
         * Restrict execution if the {@link org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench}
         * contains the given reference's name.
         */
        public Predicate exists() {
            return new Predicate() {
                public boolean matches(BindingContext context) {
                    return context.getWorkbench().getIds().containsKey(refId);
                }
            };
        }
View Full Code Here

        /**
         * Restrict execution if the annotation's classname matches the given pattern.
         */
        public Predicate matches() {
            return new Predicate() {
                public boolean matches(BindingContext context) {
                    return pattern.matcher(context.getAnnotationType().getClassName()).matches();
                }
            };
        }
View Full Code Here

    public static class Node {
        /**
         * Restrict execution if the supported {@literal Node} has the given name.
         */
        public Predicate named(final String expected) {
            return new Predicate() {
                public boolean matches(BindingContext context) {
                    if (context.getFieldNode() != null) {
                        FieldNode field = context.getFieldNode();
                        return field.name.equals(expected);
                    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.manipulator.spi.Predicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.