|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
java.lang.Objectjava.lang.reflect.AccessibleObject
public class AccessibleObject
AccessibleObject 클래스는, Field 객체, Method 객체, 및 Constructor 객체의 base class입니다. 이 클래스를 사용하면(자), 리플렉트 된 객체의 사용시에, 디폴트의 Java 언어 액세스 제어 체크를 억제할지 어떨지의 플래그 설정을 실시할 수 있습니다. 액세스 체크는, 다음의 경우에 public, 디폴트 (package) 액세스, protected, 및 private 멤버에 대해서 실행됩니다. 즉, 필드의 설정 또는 취득에 Field 가 사용되는 경우, 메소드의 호출에 Method 가 사용되는 경우, 혹은 클래스의 새로운 인스턴스의 생성 및 초기화에 Constructor 가 사용되는 경우입니다.
리플렉트 된 객체로 accessible 플래그를 설정하면(자), 충분한 특권을 가지는 고도의 어플리케이션 (Java 의 객체의 직렬화나 그 외의 지속성 기구등)은, 일반적으로은 금지되고 있는 방법으로 객체를 조작할 수 있습니다.
Field
,
Method
,
Constructor
,
ReflectPermission
생성자 의 개요 | |
---|---|
protected |
AccessibleObject ()
생성자 으로, Java 가상 머신만이 사용합니다. |
메소드의 개요 | ||
---|---|---|
|
getAnnotation (Class <T> annotationClass)
지정된 형태의 주석이 존재하는 경우는, 지정된 형태의 요소의 주석을 돌려줍니다. |
|
Annotation [] |
getAnnotations ()
이 요소에 존재하는 모든 주석을 돌려줍니다 (이 요소에 주석이 없는 경우는 길이 제로의 배열을 돌려줍니다). |
|
Annotation [] |
getDeclaredAnnotations ()
이 요소에 직접 존재하는 모든 주석을 돌려줍니다. |
|
boolean |
isAccessible ()
이 객체의 accessible 플래그의 값을 가져옵니다. |
|
boolean |
isAnnotationPresent (Class <? extends Annotation > annotationClass)
지정된 형태의 주석이 이 요소에 존재하는 경우는 true 를 돌려주어, 그렇지 않은 경우는 false 를 돌려줍니다. |
|
static void |
setAccessible (AccessibleObject [] array,
boolean flag)
효율을 자주(잘) 하기 위해서, 단일의 시큐리티 체크에 의해, 객체의 배열의 accessible 플래그를 설정하는 편리한 메소드입니다. |
|
void |
setAccessible (boolean flag)
이 객체의 accessible 플래그를, 지정된 boolean 치로 설정합니다. |
클래스 java.lang. Object 로부터 상속된 메소드 |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
생성자 의 상세 |
---|
protected AccessibleObject()
메소드의 상세 |
---|
public static void setAccessible(AccessibleObject [] array, boolean flag) throws SecurityException
시큐리티 매니저가 존재하는 경우, 우선, 시큐리티 매니저의 checkPermission
메소드가 액세스권 ReflectPermission("suppressAccessChecks")
로 불려 갑니다.
flag
가 true
의 경우,SecurityException
가 throw 됩니다만, 입력 array
의 요소의 액세스 가능성은 변함없는 것이 있습니다 (예를 들어, 요소 객체가 Class
클래스 Constructor
객체인 경우). 이러한 SecurityException 의 이벤트의 경우, 객체에의 액세스 가능성은, 예외가 생긴 요소의 직전까지의 배열 요소에 대해서는 flag
로 설정됩니다. 예외가 생긴 요소 이후의 요소에의 액세스 가능성은 변경되지 않습니다.
array
- AccessibleObject 의 배열flag
- 각 객체의 accessible 플래그의 새로운 값
SecurityException
- 요구가 거부되었을 경우SecurityManager.checkPermission(java.security.Permission)
,
RuntimePermission
public void setAccessible(boolean flag) throws SecurityException
시큐리티 매니저가 존재하는 경우, 우선, 시큐리티 매니저의 checkPermission
메소드가 액세스권 ReflectPermission("suppressAccessChecks")
로 불려 갑니다.
flag
가 true
의 경우,SecurityException
가 throw 됩니다만, 이 객체의 액세스 가능성은 변함없는 것이 있습니다 (예를 들어, 이 요소 객체가 Class
클래스 Constructor
객체인 경우).
이 객체가 java.lang.Class
클래스 Constructor
객체이며,flag
가 true 인 경우,SecurityException
가 throw 됩니다.
flag
- accessible 플래그의 새로운 값
SecurityException
- 요구가 거부되었을 경우SecurityManager.checkPermission(java.security.Permission)
,
RuntimePermission
public boolean isAccessible()
public <T extends Annotation > T getAnnotation(Class <T> annotationClass)
AnnotatedElement
의 기술:
AnnotatedElement
내의 getAnnotation
annotationClass
- 주석형에 대응하는 Class 객체
NullPointerException
- 지정된 주석 클래스가 null 의 경우public boolean isAnnotationPresent(Class <? extends Annotation > annotationClass)
AnnotatedElement
의 기술:
AnnotatedElement
내의 isAnnotationPresent
annotationClass
- 그렇지 않은 경우는 null 를 돌려줍니다. 주석형에 대응하는 Class 객체
NullPointerException
- 지정된 주석 클래스가 null 의 경우public Annotation [] getAnnotations()
AnnotatedElement
의 기술:
AnnotatedElement
내의 getAnnotations
public Annotation [] getDeclaredAnnotations()
AnnotatedElement
의 기술:
AnnotatedElement
내의 getDeclaredAnnotations
|
JavaTM Platform Standard Ed. 6 |
|||||||||
전의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.