This project has retired. For details please refer to its Attic page.
FileType xref
View Javadoc
1   package org.apache.archiva.admin.model.beans;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  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,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import javax.xml.bind.annotation.XmlRootElement;
22  import java.io.Serializable;
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  /**
27   * @author Olivier Lamy
28   * @since 1.4-M1
29   */
30  @XmlRootElement( name = "fileType" )
31  public class FileType
32      implements Serializable
33  {
34      /**
35       * Field id.
36       */
37      private String id;
38  
39      /**
40       * Field patterns.
41       */
42      private List<String> patterns;
43  
44      public FileType()
45      {
46          // no op
47      }
48  
49      public FileType( String id, List<String> patterns )
50      {
51          this.id = id;
52          this.patterns = patterns;
53      }
54  
55      public String getId()
56      {
57          return id;
58      }
59  
60      public void setId( String id )
61      {
62          this.id = id;
63      }
64  
65      public List<String> getPatterns()
66      {
67          if ( patterns == null )
68          {
69              this.patterns = new ArrayList<>( 0 );
70          }
71          return patterns;
72      }
73  
74      public void setPatterns( List<String> patterns )
75      {
76          this.patterns = patterns;
77      }
78  
79      public void addPattern( String pattern )
80      {
81          getPatterns().add( pattern );
82      }
83  
84      public void removePattern( String pattern )
85      {
86          getPatterns().remove( pattern );
87      }
88  
89      @Override
90      public boolean equals( Object o )
91      {
92          if ( this == o )
93          {
94              return true;
95          }
96          if ( o == null || getClass() != o.getClass() )
97          {
98              return false;
99          }
100 
101         FileType./../../../../org/apache/archiva/admin/model/beans/FileType.html#FileType">FileType fileType = (FileType) o;
102 
103         if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
104         {
105             return false;
106         }
107 
108         return true;
109     }
110 
111     @Override
112     public int hashCode()
113     {
114         return id != null ? 37 + id.hashCode() : 0;
115     }
116 
117     @Override
118     public String toString()
119     {
120         final StringBuilder sb = new StringBuilder();
121         sb.append( "FileType" );
122         sb.append( "{id='" ).append( id ).append( '\'' );
123         sb.append( ", patterns=" ).append( patterns );
124         sb.append( '}' );
125         return sb.toString();
126     }
127 }