Java.use(better, Tips);

《前の記事|記事一覧|次の記事》
Java.use(better, Tips);


Tips#080

java.lang.reflect.Method



過去を振り返れば振り返るほど
遠くの未来が見えてくるだろう
Winston Churchill - Wikipedia, Winston Churchill

《関連記事》

■ INDEX
$ jython
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26) 
...
>>> dir(java.lang.reflect.Method)
['DECLARED', 'PUBLIC', '__class__', '__delattr__', '__doc__', '__eq__', '__getattribute__', '__hash__', '__init__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'accessible', 'annotations', 'bridge', 'class', 'declaredAnnotations', 'declaringClass', 'defaultValue', 'equals', 'exceptionTypes', 'genericExceptionTypes', 'genericParameterTypes', 'genericReturnType', 'getAnnotation', 'getAnnotations', 'getClass', 'getDeclaredAnnotations', 'getDeclaringClass', 'getDefaultValue', 'getExceptionTypes', 'getGenericExceptionTypes', 'getGenericParameterTypes', 'getGenericReturnType', 'getModifiers', 'getName', 'getParameterAnnotations', 'getParameterTypes', 'getReturnType', 'getTypeParameters', 'hashCode', 'invoke', 'isAccessible', 'isAnnotationPresent', 'isBridge', 'isSynthetic', 'isVarArgs', 'modifiers', 'name', 'notify', 'notifyAll', 'parameterAnnotations', 'parameterTypes', 'returnType', 'setAccessible', 'synthetic', 'toGenericString', 'toString', 'typeParameters', 'varArgs', 'wait']

 ↑ TOP

■ 事例
$ jython
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26) 
...
>>> # ---------------------------------------- Dimension
>>> from java.awt import Dimension
>>> dir(Dimension)
['__class__', '__delattr__', '__doc__', '__eq__', '__getattribute__', '__hash__', '__init__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'class', 'clone', 'equals', 'getClass', 'getHeight', 'getSize', 'getWidth', 'hashCode', 'height', 'notify', 'notifyAll', 'setSize', 'size', 'toString', 'wait', 'width']
>>> d = Dimension()
>>> 
>>> # ---------------------------------------- getClass
>>> c = d.getClass(); c

>>> 
>>> # ---------------------------------------- getMethods
>>> c.getMethods()
array(java.lang.reflect.Method, ...
>>> for e in _: print e
... 
public int java.awt.Dimension.hashCode()
public boolean java.awt.Dimension.equals(java.lang.Object)
public java.lang.String java.awt.Dimension.toString()
public java.awt.Dimension java.awt.Dimension.getSize()
public void java.awt.Dimension.setSize(java.awt.Dimension)
public void java.awt.Dimension.setSize(int,int)
...
>>> 
>>> # ---------------------------------------- Method
>>> m = c.getMethods()[5]; m
public void java.awt.Dimension.setSize(int,int)
>>> m.getModifiers()
1
>>> m.getDeclaringClass()

>>> m.getName()
u'setSize'
>>> m.getReturnType()

>>> m.getParameterTypes()
array(java.lang.Class, ...
>>> for e in _: print e
... 


>>> m.getExceptionTypes()
array(java.lang.Class)
>>> 
>>> # ---------------------------------------- EOF

 ↑ TOP

》作業中です《

update*13/03/04 19:53:22