File: index.html

package info (click to toggle)
objenesis 3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,140 kB
  • sloc: java: 3,839; xml: 1,579; sh: 59; makefile: 2
file content (97 lines) | stat: -rw-r--r-- 3,806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!--

    Copyright 2006-2024 the original author or authors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<html lang="en">
<head>
    <title>About</title>
</head>

<body>

<p>Objenesis is a small Java library that serves one purpose:</p>

<ul>
    <li><strong>To instantiate a new object of a particular class.</strong></li>
</ul>

<h1>When would you want this?</h1>

<p>Java already supports this dynamic instantiation of classes using <code>Class.newInstance()</code>.
    However, this only works if the class has an appropriate constructor. There are many times when a class
    cannot be instantiated this way, such as when the class contains:</p>

<ul>
    <li>Constructors that require arguments.</li>
    <li>Constructors that have side effects.</li>
    <li>Constructors that throw exceptions.</li>
</ul>

<p>As a result, it is common to see restrictions in libraries stating that classes must require a
    default constructor. Objenesis aims to overcome these restrictions by bypassing the constructor on object
    instantiation.</p>

<h1>Typical uses</h1>

<p>Needing to instantiate an object without calling the constructor is a fairly specialized task, however
    there are certain cases when this is useful:</p>
<ul>
    <li><strong>Serialization, Remoting and Persistence</strong>
        - Objects need to be instantiated and restored to a specific state, without invoking code.
    </li>
    <li><strong>Proxies, AOP Libraries and Mock Objects</strong>
        - Classes can be subclassed without needing to worry about the super() constructor.
    </li>
    <li><strong>Container Frameworks</strong>
        - Objects can be dynamically instantiated in non-standard ways.
    </li>
</ul>

<h1>Getting Started</h1>

<ol>
    <li><a href="download.html">Download</a> Objenesis.</li>
    <li>Read the <a href="tutorial.html">twenty second tutorial</a>.</li>
</ol>

<h1>How it Works</h1>

<p>Objenesis uses a variety of approaches to attempt to instantiate the object, depending on the type of object,
JVM version, JVM vendor and SecurityManager present. These are described in full in the
    <a href="details.html">detailed documentation</a>.</p>

<h1>Avoiding the Dependency</h1>

<p>For something as straight forward as instantiating an object, it can be a pain introducing yet another
    library dependency into your project. Objenesis is easy to <a href="embedding.html">embed in your
    existing library</a> so your end users don't even know it's there.</p>


<h1>Supported JVMs</h1>

<p>The list of tested JVMs is available <a href="https://github.com/easymock/objenesis/blob/master/SupportedJVMs.md">here</a>.
Other JVMs might be supported be haven't been tested yet. You can test your environment using the
<a href="details.html#testYourEnvironment">TCK</a> and we would be glad to have <a href="support.html">feedback</a>
on any supported / unsupported JVM.</p>

<h1>Benchmarking</h1>

<p>We do more and more benchmarking to make sure Objenesis has great performance but also to settled the best way to
use it for multiple use-cases. Results are added <a href="https://github.com/easymock/objenesis/blob/master/Benchmarks.md">here</a>. Please, <a href="support.html">share your own results</a>.
Especially, if they differ from ours.</p>

</body>
</html>