---
title: "Bypass Encapsulation   "
author: "tracyhuyan"
date: "2012-03-07T12:17:42Z"
tags: []
categories: ["编程语言"]
slug: "bypass-encapsulation"
draft: false
lastmod: "2012-03-07T12:17:31Z"
id: 1442633
url: "https://tracyhuyan.iteye.com/blog/1442633"
---

1. Use `Whitebox.setInternalState(..)` to set a private member of an instance or class.
2. Use `Whitebox.getInternalState(..)` to get a private member of an instance or class.
3. Use `Whitebox.invokeMethod(..)` to invoke a private method of an instance or class.
4. Use `Whitebox.invokeConstructor(..)` to create an instance of a class with a private constructor.