All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.parceler.internal.matcher.MutableLiveDataMatcher Maven / Gradle / Ivy

There is a newer version: 1.1.13
Show newest version
package org.parceler.internal.matcher;

import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import org.androidtransfuse.adapter.ASTStringType;
import org.androidtransfuse.adapter.ASTType;
import org.androidtransfuse.util.matcher.Matcher;
import org.androidtransfuse.util.matcher.Matchers;
import org.parceler.internal.Generators;

public class MutableLiveDataMatcher implements Matcher {

    private static final Matcher MATCHER = Matchers.type(new ASTStringType("android.arch.lifecycle.MutableLiveData")).ignoreGenerics().build();

    private final Generators generators;

    public MutableLiveDataMatcher(Generators generators) {
        this.generators = generators;
    }

    @Override
    public boolean matches(ASTType input) {
        return MATCHER.matches(input) &&
                input.getGenericArgumentTypes().size() == 1 &&
                FluentIterable.from(input.getGenericArgumentTypes()).allMatch(new Predicate() {
                    public boolean apply(ASTType astType) {
                        return generators.matches(astType);
                    }
                });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy