Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. import javax.xml.bind.annotation.XmlRootElement;
  21. import java.io.Serializable;
  22. import java.util.ArrayList;
  23. import java.util.List;
  24. /**
  25. * @author Olivier Lamy
  26. * @since 1.4-M1
  27. */
  28. @XmlRootElement( name = "fileType" )
  29. public class FileType
  30. implements Serializable
  31. {
  32. /**
  33. * Field id.
  34. */
  35. private String id;
  36. /**
  37. * Field patterns.
  38. */
  39. private List<String> patterns;
  40. public FileType()
  41. {
  42. // no op
  43. }
  44. public FileType( String id, List<String> patterns )
  45. {
  46. this.id = id;
  47. this.patterns = patterns;
  48. }
  49. public String getId()
  50. {
  51. return id;
  52. }
  53. public void setId( String id )
  54. {
  55. this.id = id;
  56. }
  57. public List<String> getPatterns()
  58. {
  59. if ( patterns == null )
  60. {
  61. this.patterns = new ArrayList<>( 0 );
  62. }
  63. return patterns;
  64. }
  65. public void setPatterns( List<String> patterns )
  66. {
  67. this.patterns = patterns;
  68. }
  69. public void addPattern( String pattern )
  70. {
  71. getPatterns().add( pattern );
  72. }
  73. public void removePattern( String pattern )
  74. {
  75. getPatterns().remove( pattern );
  76. }
  77. @Override
  78. public boolean equals( Object o )
  79. {
  80. if ( this == o )
  81. {
  82. return true;
  83. }
  84. if ( o == null || getClass() != o.getClass() )
  85. {
  86. return false;
  87. }
  88. FileType fileType = (FileType) o;
  89. if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
  90. {
  91. return false;
  92. }
  93. return true;
  94. }
  95. @Override
  96. public int hashCode()
  97. {
  98. return id != null ? 37 + id.hashCode() : 0;
  99. }
  100. @Override
  101. public String toString()
  102. {
  103. final StringBuilder sb = new StringBuilder();
  104. sb.append( "FileType" );
  105. sb.append( "{id='" ).append( id ).append( '\'' );
  106. sb.append( ", patterns=" ).append( patterns );
  107. sb.append( '}' );
  108. return sb.toString();
  109. }
  110. }