View Javadoc
1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied. See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.wss4j.common.saml.bean;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  import org.w3c.dom.Element;
26  
27  
28  /**
29   * Represents a SAML Advice Element.
30   */
31  public class AdviceBean {
32  
33      private List<String> idReferences = new ArrayList<>();
34      private List<String> uriReferences = new ArrayList<>();
35      private List<Element> assertions = new ArrayList<>();
36  
37      public List<String> getIdReferences() {
38          return idReferences;
39      }
40  
41      public List<String> getUriReferences() {
42          return uriReferences;
43      }
44  
45      public List<Element> getAssertions() {
46          return assertions;
47      }
48  
49      @Override
50      public boolean equals(Object o) {
51          if (this == o) {
52              return true;
53          }
54          if (!(o instanceof AdviceBean)) {
55              return false;
56          }
57  
58          AdviceBean that = (AdviceBean) o;
59  
60          if (idReferences == null && that.idReferences != null) {
61              return false;
62          } else if (idReferences != null && !idReferences.equals(that.idReferences)) {
63              return false;
64          }
65  
66          if (uriReferences == null && that.uriReferences != null) {
67              return false;
68          } else if (uriReferences != null && !uriReferences.equals(that.uriReferences)) {
69              return false;
70          }
71  
72          if (assertions == null && that.assertions != null) {
73              return false;
74          } else if (assertions != null && !assertions.equals(that.assertions)) {
75              return false;
76          }
77  
78          return true;
79      }
80  
81      @Override
82      public int hashCode() {
83          int result = 0;
84          if (idReferences != null) {
85              result = 31 * result + idReferences.hashCode();
86          }
87          if (uriReferences != null) {
88              result = 31 * result + uriReferences.hashCode();
89          }
90          if (assertions != null) {
91              result = 31 * result + assertions.hashCode();
92          }
93          return result;
94      }
95  
96  }