Home | History | Annotate | Download | only in manifest
      1 package org.robolectric.manifest;
      2 
      3 import java.util.ArrayList;
      4 import java.util.List;
      5 
      6 public class IntentFilterData {
      7   private final List<String> actions;
      8   private final List<String> categories;
      9   private final List<String> schemes;
     10   private final List<String> mimeTypes;
     11   private final List<DataAuthority> authorities;
     12   private final List<String> paths;
     13   private final List<String> pathPatterns;
     14   private final List<String> pathPrefixes;
     15 
     16   public IntentFilterData(List<String> actions, List<String> categories) {
     17     this.actions = actions;
     18     this.categories = new ArrayList<>(categories);
     19     this.schemes = new ArrayList<>();
     20     this.mimeTypes = new ArrayList<>();
     21     this.authorities = new ArrayList<>();
     22     this.paths = new ArrayList<>();
     23     this.pathPatterns = new ArrayList<>();
     24     this.pathPrefixes = new ArrayList<>();
     25   }
     26 
     27   public List<String> getActions() {
     28     return actions;
     29   }
     30 
     31   public List<String> getCategories() {
     32     return categories;
     33   }
     34 
     35   public List<String> getSchemes() {
     36     return schemes;
     37   }
     38 
     39   public List<String> getMimeTypes() {
     40     return mimeTypes;
     41   }
     42 
     43   public List<DataAuthority> getAuthorities() {
     44     return authorities;
     45   }
     46 
     47   public List<String> getPaths() {
     48     return paths;
     49   }
     50 
     51   public List<String> getPathPatterns() {
     52     return pathPatterns;
     53   }
     54 
     55   public List<String> getPathPrefixes() {
     56     return pathPrefixes;
     57   }
     58 
     59   public void addScheme(String scheme) {
     60     if (scheme != null) {
     61       schemes.add(scheme);
     62     }
     63   }
     64 
     65   public void addMimeType(String mimeType) {
     66     if (mimeType != null) {
     67       mimeTypes.add(mimeType);
     68     }
     69   }
     70 
     71   public void addPath(String path) {
     72     if (path != null) {
     73       paths.add(path);
     74     }
     75   }
     76 
     77   public void addPathPattern(String pathPattern) {
     78     if (pathPattern != null) {
     79       pathPatterns.add(pathPattern);
     80     }
     81   }
     82 
     83   public void addPathPrefix(String pathPrefix) {
     84     if (pathPrefix != null) {
     85       pathPrefixes.add(pathPrefix);
     86     }
     87   }
     88 
     89   public void addAuthority(String host, String port) {
     90     if (host != null) {
     91       authorities.add(new DataAuthority(host, port));
     92     }
     93   }
     94 
     95   public static class DataAuthority {
     96     private String host;
     97     private String port;
     98 
     99     public DataAuthority(String host, String port) {
    100       this.host = host;
    101       this.port = port;
    102     }
    103 
    104     public String getHost() {
    105       return host;
    106     }
    107 
    108     public String getPort() {
    109       return port;
    110     }
    111   }
    112 }
    113