473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

are there wrapper klasses for primitives?

hi how would you implement an int variable for example which is loaded from
a database and therefore can have a value of DBNull. due to the fact that
primitives are structs rather than classes they cannot be null.

how would you solve this?

1. programming an own wrapper class
2. save it as object an cast when int value is needed
3. treat -1 as null-value
4. save it as string and cast if neccassary

in java there are predefined wrappers for all primitives which could be used
in this situation.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Jul 19 '05 #1
0 1393

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PerfectDayToChaseTornados | last post by:
Hi All, I am trying to create a BeanHelper class which will set a beans values from the request much the same as it would be form a jsp using 'usebean'. I can get everything to work except for...
5
by: Fred | last post by:
Are primitives objects? int i = 3; System.out.println(i.getClass()); doesn't compile. Get an error message "int can't be dereferenced" But yet the docs for class Object say: Class Object...
12
by: Egil M?ller | last post by:
Is there any way to create transparent wrapper objects in Python? I thought implementing __getattribute__ on either the wrapper class or its metaclass would do the trick, but it does not work for...
3
by: Ian | last post by:
Has anyone had any experience in writing wrappers for older C libraries? What I'm looking at doing is creating a wrapper C++ object as a front end to an older C library, also the library is not...
0
by: cody | last post by:
hi how would you implement an int variable for example which is loaded from a database and therefore can have a value of DBNull. due to the fact that primitives are structs rather than classes they...
4
by: Carl-Olof Almbladh | last post by:
Dear all, In C99, complex is now built in, and the C library contains functions for complex exp, etc. It is not so easy to find info about the syntax if one is not willing to buy the ISO/ANSI...
2
by: Bill Nguyen | last post by:
below is the error message I received when about 2/3 of the process is done. Where in my code I sould look for? Thanks Bill --------- The CLR has been unable to transition from COM context...
16
by: utab | last post by:
Dear all, In programming terminology, what is a wrapper and where is it used? Regards
1
by: colin | last post by:
Hi, I have this code wich fills in data fields from a file, recursivley down through any structures/classes the difficulty is when I come acros a field wich is a structure, wich can not be read...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.