PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/parser-java-api/src/main/java/org/jboss/forge/parser/java/Method.java

https://github.com/includeeasy/core
Java | 128 lines | 24 code | 22 blank | 82 comment | 0 complexity | a934aa49f2ec75938a16f2bf6940c593 MD5 | raw file
  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2010, Red Hat, Inc., and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.forge.parser.java;
  23. import java.util.List;
  24. import org.jboss.forge.parser.Origin;
  25. /**
  26. * Represents a Java Method.
  27. *
  28. * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
  29. *
  30. */
  31. public interface Method<O> extends Abstractable<Method<O>>, Member<O, Method<O>>, Origin<O>
  32. {
  33. /**
  34. * Get the inner body of this {@link Method}
  35. */
  36. public String getBody();
  37. /**
  38. * Set the inner body of this {@link Method}
  39. */
  40. public Method<O> setBody(final String body);
  41. /**
  42. * Toggle this method as a constructor. If true, and the name of the {@link Method} is not the same as the name of
  43. * its parent {@link JavaClass} , update the name of the to match.
  44. */
  45. public Method<O> setConstructor(final boolean constructor);
  46. /**
  47. * Return true if this {@link Method} is a constructor for the class in which it is defined.
  48. */
  49. public boolean isConstructor();
  50. /**
  51. * Set the name of this {@link Method}
  52. */
  53. public Method<O> setName(final String name);
  54. /**
  55. * Get the return type of this {@link Method} or return null if the return type is void.
  56. */
  57. public String getReturnType();
  58. /**
  59. * Set this {@link Method} to return the given type.
  60. */
  61. public Method<O> setReturnType(final Class<?> type);
  62. /**
  63. * Set this {@link Method} to return the given type.
  64. */
  65. public Method<O> setReturnType(final String type);
  66. /**
  67. * Return true if this {@link Method} has a return type of 'void'
  68. */
  69. public boolean isReturnTypeVoid();
  70. /**
  71. * Set this {@link Method} to return 'void'
  72. */
  73. public Method<O> setReturnTypeVoid();
  74. /**
  75. * Set this {@link Method}'s parameters.
  76. */
  77. public Method<O> setParameters(String string);
  78. /**
  79. * Get a list of this {@link Method}'s parameters.
  80. */
  81. public List<Parameter> getParameters();
  82. /**
  83. * Convert this {@link Method} into a string representing its unique signature.
  84. */
  85. public String toSignature();
  86. /**
  87. * Add a thrown {@link Exception} to this method's signature.
  88. */
  89. public Method<O> addThrows(String type);
  90. /**
  91. * Add a thrown {@link Exception} to this method's signature.
  92. */
  93. public Method<O> addThrows(Class<? extends Exception> type);
  94. /**
  95. * Get a list of qualified (if possible) {@link Exception} class names thrown by this method.
  96. */
  97. public List<String> getThrownExceptions();
  98. /**
  99. * Remove a thrown {@link Exception} to this method's signature.
  100. */
  101. public Method<O> removeThrows(String type);
  102. /**
  103. * Remove a thrown {@link Exception} to this method's signature.
  104. */
  105. public Method<O> removeThrows(Class<? extends Exception> type);
  106. }