Home | History | Annotate | Download | only in iface
      1 /*
      2  * Copyright 2012, Google Inc.
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions are
      7  * met:
      8  *
      9  *     * Redistributions of source code must retain the above copyright
     10  * notice, this list of conditions and the following disclaimer.
     11  *     * Redistributions in binary form must reproduce the above
     12  * copyright notice, this list of conditions and the following disclaimer
     13  * in the documentation and/or other materials provided with the
     14  * distribution.
     15  *     * Neither the name of Google Inc. nor the names of its
     16  * contributors may be used to endorse or promote products derived from
     17  * this software without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 package org.jf.dexlib2.iface;
     33 
     34 import org.jf.dexlib2.iface.debug.LocalInfo;
     35 import org.jf.dexlib2.iface.reference.TypeReference;
     36 
     37 import javax.annotation.Nonnull;
     38 import javax.annotation.Nullable;
     39 import java.util.Set;
     40 
     41 /**
     42  * This class represents a method parameter.
     43  *
     44  * It also acts as a TypeReference to the type of this parameter. Any equality/comparison is based on its identity as a
     45  * TypeReference, and should not take into account any details other than the parameter type.
     46  *
     47  * It also acts as a LocalInfo object, and conceptually defines the debug information for any parameter register at the
     48  * beginning of the method.
     49  */
     50 public interface MethodParameter extends TypeReference, LocalInfo {
     51     /**
     52      * The type of this method parameter.
     53      *
     54      * This may be any type, including primitive or array types, other than the void (V) type.
     55      *
     56      * @return The type of this method parameter
     57      */
     58     @Nonnull String getType();
     59 
     60     /**
     61      * Gets a set of the annotations that are applied to this parameter.
     62      *
     63      * The annotations in the returned set are guaranteed to have unique types.
     64      *
     65      * @return A set of the annotations that are applied to this parameter
     66      */
     67     @Nonnull Set<? extends Annotation> getAnnotations();
     68 
     69     /**
     70      * Gets the name of this parameter, if available.
     71      *
     72      * @return The name of this parameter, or null if the name is not available.
     73      */
     74     @Nullable String getName();
     75 
     76     /**
     77      * Gets the signature of this parameter, if available.
     78      *
     79      * The signature of a parameter is defined to be the concatenated version of the dalvik.annotation.Signature
     80      * annotation applied to this parameter, or null if there is no dalvik.annotation.Signature annotation.
     81      *
     82      * @return The signature of this parameter, or null if not available
     83      */
     84     @Nullable String getSignature();
     85 }
     86