Listando os métodos de uma classe
27/07/2015 12:09
?"a".metaClass.methods*.name.sort()?
"a".metaClass.methods*.name.sort()?, temos como resultado:
?[charAt, codePointAt, codePointBefore, codePointCount, compareTo, compareToIgnoreCase, concat, contains, contentEquals, contentEquals, copyValueOf, copyValueOf, endsWith, equals, equals, equalsIgnoreCase, format, format, getBytes, getBytes, getBytes, getBytes, getChars, getClass, hashCode, hashCode, indexOf, indexOf, indexOf, indexOf, intern, isEmpty, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, length, matches, notify, notifyAll, offsetByCodePoints, regionMatches, regionMatches, replace, replace, replaceAll, replaceFirst, split, split, startsWith, startsWith, subSequence, substring, substring, toCharArray, toLowerCase, toLowerCase, toString, toString, toUpperCase, toUpperCase, trim, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, wait, wait, wait]? Mas as Strings em Groovy tem outro métodos, como
center,
capitalize, etc. Esse métodos não são apresentados pelo comando. Tive que utilizar o
:inspectdo
groovyshpara descobrir. Gostaria de saber se haveria outra forma, como o comando que utilizei no post anterior, mas que mostrasse métodos groovy. Obrigado.
Para se registrar, clique aqui.