Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 100406 Details for
Bug 232271
Allow executable extensions to be lazy loaded
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Sample Class to handle lazy loading through dynamic proxies
LazyLoader.java (text/plain), 917 bytes, created by
Erdal Karaca
on 2008-05-15 06:53:33 EDT
(
hide
)
Description:
Sample Class to handle lazy loading through dynamic proxies
Filename:
MIME Type:
Creator:
Erdal Karaca
Created:
2008-05-15 06:53:33 EDT
Size:
917 bytes
patch
obsolete
>import java.lang.reflect.InvocationHandler; >import java.lang.reflect.Method; > >public class LazyLoader > implements InvocationHandler { > private String classRef; > private Object obj; > > public LazyLoader( String classRef ) { > this.classRef = classRef; > } > > public Object invoke( Object proxy, Method method, Object[] args ) > throws Throwable { > if ( obj == null ) { > try { > obj = Class.forName( classRef, true, > proxy.getClass().getClassLoader() ).newInstance(); > } catch ( Exception e ) { > throw e; > } > } > > return method.invoke( obj, args ); > } > > public static <T> T newInstance( String classRef, Class... interfaces ) { > if ( classRef == null > || interfaces == null || interfaces.length == 0 ) { > return null; > } > > return (T) java.lang.reflect.Proxy.newProxyInstance( > interfaces[ 0 ].getClassLoader(), interfaces, new LazyLoader( > classRef ) ); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 232271
: 100406