1 /* 2 * ASMethod.java 3 * 4 * Copyright (c) 2006 David Holroyd 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * 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, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package uk.co.badgersinfoil.metaas.dom; 20 21 22 /** 23 * An ActionScript method definition within an ActionScript class or 24 * interface. 25 * 26 * @see ASType#newMethod(String, Visibility, String) 27 */ 28 public interface ASMethod extends FunctionCommon, StatementContainer, ASMember { 29 30 /** 31 * Constants defined by this class denote whether a method is actually 32 * an accessor 'get' or 'set' function. 33 * 34 * @see ASMethod#getAccessorRole() 35 * @see ASMethod#setAccessorRole(AccessorRole) 36 */ 37 public static final class AccessorRole { 38 private String text; 39 40 private AccessorRole(String text) { this.text = text; } 41 /** 42 * A standard method; not a getter or setter. 43 */ 44 public static final AccessorRole NORMAL_METHOD = new AccessorRole("NORMAL_METHOD"); 45 /** 46 * The method is a 'get' accessor 47 */ 48 public static final AccessorRole SETTER = new AccessorRole("SETTER"); 49 /** 50 * The method is a 'set' accessor 51 */ 52 public static final AccessorRole GETTER = new AccessorRole("GETTER"); 53 54 public String toString() { return text; } 55 } 56 57 /** 58 * Returns a value representing any protection-against-access defined 59 * for this ActionScript method. 60 */ 61 public Visibility getVisibility(); 62 63 /** 64 * Defines the level of protection-against-external-access for this 65 * ActionScript method. 66 */ 67 public void setVisibility(Visibility visibility); 68 69 /** 70 * Returns true if this ActionScript method is static (i.e. the method 71 * definition uses the <code>static</code> keyword). 72 */ 73 public boolean isStatic(); 74 75 /** 76 * Defines whether this ActionScript method is static or not. 77 */ 78 public void setStatic(boolean s); 79 80 /** 81 * Returns on of {@link AccessorRole#NORMAL_METHOD}, 82 * {@link AccessorRole#GETTER} or {@link AccessorRole#SETTER}, with 83 * NORMAL_METHOD being the default for newly synthesised methods. 84 */ 85 public AccessorRole getAccessorRole(); 86 87 /** 88 * Allows the role of a method to be changed. 89 */ 90 public void setAccessorRole(AccessorRole getter); 91 92 /** 93 * Shortcut method to update the <code><span>@</span>return</code> 94 * tagged paragraph in this method's documentation comment, or create 95 * one if it doesn't exist. 96 */ 97 public void setReturnDescription(String description); 98 99 /** 100 * Returns any description of the return value from this methods 101 * documentation comment. If there is no doc-comment, or if the 102 * documentation does not contain a <code><span>@</span>return</code> 103 * tagged paragraph, this method will return null. 104 * 105 * @see DocComment 106 */ 107 public String getReturnDescriptionString(); 108 }