1 /*
   2  * Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.jemmy.support.test;
  24 
  25 import java.util.LinkedList;
  26 import java.util.List;
  27 import javax.lang.model.element.ExecutableElement;
  28 import javax.lang.model.element.TypeElement;
  29 
  30 /**
  31  *
  32  * @author shura
  33  */
  34 public class LookupSupport {
  35     private final List<SupportParameter> params = new LinkedList<SupportParameter>();
  36     private final ExecutableElement method;
  37     private final String description;
  38     private final TypeElement cls;
  39 
  40     /**
  41      * 
  42      * @param cls
  43      * @param method
  44      * @param description
  45      */
  46     public LookupSupport(TypeElement cls, ExecutableElement method, String description) {
  47         this.cls = cls;
  48         this.method = method;
  49         this.description = description;
  50     }
  51 
  52     /**
  53      * 
  54      * @return
  55      */
  56     public TypeElement getDeclaringType() {
  57         return cls;
  58     }
  59 
  60     /**
  61      * 
  62      * @return
  63      */
  64     public List<SupportParameter> getParams() {
  65         return params;
  66     }
  67 
  68     /**
  69      * 
  70      * @return
  71      */
  72     public String getDescription() {
  73         return description;
  74     }
  75 
  76     /**
  77      * 
  78      * @return
  79      */
  80     public ExecutableElement getMethod() {
  81         return method;
  82     }
  83     
  84     /**
  85      * 
  86      * @param another
  87      * @return
  88      */
  89     public boolean equalInTypes(LookupSupport another) {
  90         if(another.getParams().size() == getParams().size()) {
  91             for (int i = 0; i < getParams().size(); i++) {
  92                 if(!another.getParams().get(i).getType().toString()
  93                         .equals(getParams().get(i).getType().toString())) {
  94                     return false;
  95                 }
  96             }
  97             return true;
  98         } else {
  99             return false;
 100         }
 101     }
 102 }