Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
Search the Tips
Tip Bank > Java > Classes

Classes - Page 4

61-80 of 419     Previous     Next
GetField - Retrieving the value of a public field via reflection
by Francesco Balena
Return the value of the public field with the specified name, defined inside the obj object Note: requires Imports System.Reflection Example: Public TestField As String = "hello" ... MessageBox.Show(GetField(Me, "TestField", ""))
GetProperty - Reading a property via reflection
by Francesco Balena
Read a property via reflection or return a default value Example: MessageBox.Show(GetProperty(Button1, "Text", ""))
InvokeMethod - Invoking a method via reflection
by Francesco Balena
Invoke a method via reflection and return its result - return null if method doesn't exist or throws Note: requires Imports System.Reflection Example: Function GetCompleteName(ByVal firstName As String, ByVal lastName As String) Return lastName & ", " & firstName End Function ... MessageBox.
IsMemberSupported - Check whether an object supports a member with the specified name
by Marco Bellinaso
Check whether an object supports a member with the specified name Examples: Debug.WriteLine(IsMemberSupported(Button1, "BackColor")) ' => True Debug.WriteLine(IsMemberSupported(Button1, "Focus")) ' => True Debug.WriteLine(IsMemberSupported(Button1, "TextColor")) ' => False Debug.
SetProperty - Setting a property via reflection
by Francesco Balena
Set a property via reflection and return True if successful Example: SetProperty(Button1, "Text", "Click me")
Extend Swing's JTable to Support Rendering of Different Cell Types in a Column
by Lara D'Abreo
LoadBinaryData - Deserializing an object from a file in binary format
by Marco Bellinaso
Deserialize an object from a file in binary format It can handle types that the SOAP serialization can't Requires: Imports System.IO Imports System.Runtime.Serialization.Formatters.Binary
SaveBinaryData - Serializing an object to file in binary format
by Marco Bellinaso
Serialize an object to file in binary format It can handle types that the SOAP serialization can't Requires: Imports System.IO Imports System.Runtime.Serialization.Formatters.Binary
Abstract classes as interfaces
by Danny Kalev
In software design, you should plan ahead the interface of a class hierarchy to make sure that all related concrete classes share a common interface. This can be achieved by using abstract ...
Dynamically setting an event handler for a class' event via reflection
by Francesco Balena
Here it is some code that shows how to use reflection to dynamically set an event handler for a class' event. Sub TestSub() ' create a Person Dim pe As New Person() ' get a reference to the EventInfo for this object Dim peEv As EventInfo = pe.GetType.
CloneObject - cloning an object by serializing it to a memory stream
by Francesco Balena
A reusable function that does object cloning by serializing it to a memory stream
LoadSoapData - deserializing an object from a file in SOAP format
by Francesco Balena
Deserialize an object from a file in SOAP format.
SaveSoapData - serializing an object to file in SOAP format
by Francesco Balena
Serialize an object to file in SOAP format.
A command-line Object Browser that uses Reflection
by Francesco Balena
This code is taken from Francesco Balena's "Programming Microsoft Visual Basic .NET" - MS Press 2002, ISBN 0735613753 You can read a free chapter of the book at http://www.vb2themax.com/HtmlDoc.asp?Table=Books&ID=101000
FilterByName - filtering by name the results of Type.FindMembers
by Francesco Balena
This filtering function returns True if the member name begins with the character passed as its second argument. Note: it requires Imports System.Reflection
FilterByType - filtering the results of Type.FindMembers by thier return type
by Francesco Balena
Accept only properties and methods whose return value matches the Type passed as the second argument. Note: it requires Imports System.Reflection
Set up event handlers through reflection
by Francesco Balena
Reflection makes it easy to invoke a method (or assign a field or a property) by its name. For example, suppose you have the following classes: Class Person Event PropertyChanged(ByVal propertyName As String, ByVal newValue As Object) Dim m_Name As String Property ...
D
by Brian Ray
You can use the technique for an "undo" menu/toolbar option. Use a collection instead of a listbox to reduce overhead. Support for both LIFO and FIFO is also included: ...
Send Mail Using a VC++ Application
by Amit Vij
Import the complete path of the following files in your application using the #import ...
Implementing ICloneable - Deep copies
by Francesco Balena
The simplest way to create a generic deep copy routine, that is a procedure that can create a true, distinct copy of an object and all its dependent object, is to rely on the serialization features of the .NET framework. Function CloneObject(ByVal obj As Object) As Object ...
61-80 of 419     Previous     Next
Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date