View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.github.maven_nar.cpptasks.ide;
21  
22  import java.io.File;
23  import java.util.Collections;
24  import java.util.List;
25  
26  import org.apache.tools.ant.util.StringUtils;
27  
28  /**
29   * Defines a dependency
30   *
31   */
32  public final class DependencyDef {
33    private String id;
34    private File file;
35    private String name;
36    private String depends;
37  
38    public DependencyDef() {
39    }
40  
41    public String getDepends() {
42      return this.depends;
43    }
44  
45    public List<String> getDependsList() {
46      if (this.depends != null) {
47        return StringUtils.split(this.depends, ',');
48      }
49      return Collections.emptyList();
50    }
51  
52    public File getFile() {
53      return this.file;
54    }
55  
56    public String getID() {
57      if (this.id != null) {
58        return this.id;
59      }
60      return getName();
61    }
62  
63    public String getName() {
64      if (this.name != null) {
65        return this.name;
66      } else if (this.file != null) {
67        return this.file.getName();
68      }
69      return "null";
70    }
71  
72    public void setDepends(final String val) {
73      this.depends = val;
74    }
75  
76    public void setFile(final File val) {
77      this.file = val;
78    }
79  
80    public void setID(final String val) {
81      this.id = val;
82    }
83  
84    public void setName(final String val) {
85      this.name = val;
86    }
87  }