How to use constructor to create a null object?
I am trying to extend java.sql.Timestamp class. However, I am not sure what to do with a null Timestamp object. The constructor of Timestamp always creates a valid Timestamp object. Anyone have any idea how to create a null object using constructor? Thanks.
Julia
when you create an object i.e., instantiate an object there are three steps that are followed behind the scene.
1) Assign memory
2) Allocate a reference
3) constructor is called.
Now there is no such thing as a null object as has been pointed out however in case you mean you just want to assign a null reference to a variable then you are not instantiating an object and not calling a constructor but you could simply do
String sqlQuery = null;But keep in mind that the object has not been instantiated and neither initialized here. Constructors basically do the initialization.
Similar Messages
-
How to use SNRO to create daily number range?
Dear all,
I would like to know how to use SNRO to create a daily number range.
We would like to have the following sequence. The first 8 digits are date and the last 2 digits are number sequence. Each day, the last 2 digits will start from 01 again. i.e. <8-digits date><2-digit sequence>
For example, today is 22 May 2006,
2006052201
2006052202
2006052203
Tomorrow will have sequence like this:
2006052301
2006052302
2006052303
Thanks!Thomas,
I don't there is a automated way of doing as the dates do NOT follow a numbering sequence. What you can do is to create a number range for getting the last two digits every day and manually concatenate the date with the serial number.
However, as you have to reset the counter every day that might be a issue.
Regards,
Ravi -
I am embarking on a new project to create a joomla template. I need your ideas on how to use Dreamweaver to create the template. TQ
It's pretty much the same procedure with all your open source CMSs (WordPress, Drupal, Joomla!...)
Start with this 4 Part Tutorial:
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt1.html
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
How to use CSS to create horizontal nav bar in Dreamweaver CS6
How to use CSS to create horizontal nav bar in Dreamweaver CS6
One of the ways to do it is this: Tryit Editor v1.9
You can also use floats to get something to the same effect. -
How to use the dll created by c++ but not write a jni wrapper around
how to use the dll created by c++ but not write a jni wrapper around through a java program. now I can't access that dll like this directly from java.
Your question is unclear. (You haven't said what dll you are talking about.)
But:
If you are talking about an existing dll, then the only alternative to writing a wrapper is to use one of the wrapper generators floating around. Do a search on JACE.
If you are talking about a dll you are writing, then run jah and get the interface to match java right away; then you won't have to write a wrapper. -
How to use the index method for pathpoints object in illustrator through javascripts
hii...
am using Illustrator CS2 using javascripts...
how to use the index method for pathpoints object in illustrator through javascripts..Hi, what are you trying to do with path points?
CarlosCanto -
How to use a session, created in a jsp page, in a php page
Hello, forgive me for the newbie question.
Here is my problem:
I want to have a jsp page create a session, set some session variables and then redirect to a php page which will access those same session variables.
I have the redirection worked out, but I can't seem to find out how to use the jsp session in my php script.
Is this possible at all, and if so, how does it work?Note that javascript runs on the client side, and JSP runs on the server. JSP and the session objects are NOT available to javascript in reaction to the user.
If this function is called only when the page is first created, not when the user interacts with the page, or if you want that value to be constant with respect to the javascript, then you can do this:
<%
String someValue = (String)session.getAttribute("theAttributeName");
%>
<script type="text/javascript">
Calendar.setup({inputField:"f_date_dfFirstPmtDate",
button:"f_trigger_dfFirstPmtDate",
singleClick:true,
ifFormat:<%=someVale%>});
</script> -
How To: Use reflection to create instance of generic type?
I would like to be able to use reflection to instantiate an instance of a generic type, but can't seem to avoid getting type safety warnings from the compiler. (I'm using Eclipse 3.1.1) Here is a trivial example: suppose I want to create an instance of a list of strings using reflection.
My first guess was to write the following:
Class cls = Class.forName("java.util.ArrayList<String>");
List<String> myList = cls.newInstance();The call to Class.forName throws a ClassNotFoundException. OK, fine, so I tried this:
Class cls = Class.forName("java.util.ArrayList");
List<String> myList = cls.newInstance();Now the second line generates the warning "Type safety: The expression of type List needs unchecked conversion to conform to List<String>".
If I change the second line to
List<String> myList = (List<String>)cls.newInstance();then I get the compiler warning "Type safety: The cast from Object to List<String> is actually checking against the erased type List".
This is a trivial example that illustrates my problem. What I am trying to do is to persist type-safe lists to an XML file, and then read them back in from XML into type-safe lists. When reading them back in, I don't know the type of the elements in the list until run time, so I need to use reflection to create an instance of a type-safe list.
Is this erasure business prohibiting me from doing this? Or does the reflection API provide a way for me to specify at run time the type of the elements in the list? If so, I don't see it. Is my only recourse to simply ignore the type safety warnings?Harald,
I appreciate all your help on this topic. I think we are close to putting this thing to rest, but I'd like to run one more thing by you.
I tried something similar to your suggestion:public static <T> List<T> loadFromStorage(Class<T> clazz) {
List<T> list = new ArrayList<T>();
for ( ...whatever ...) {
T obj = clazz.newInstance();
// code to load from storage ...
list.add(obj);
return list;
}And everything is fine except for one small gotcha. The argument to this method is a Class<T>, and what I read from my XML storage is the fully qualified name of my class(es). As you pointed out earlier, the Class.forName("Foo") method will return a Class<?> rather than a Class<Foo>. Therefore, I am still getting a compiler warning when attempting to produce the argument to pass to the loadFromStorage method.
I was able to get around this problem and eliminate the compiler warning, but I'm not sure I like the way I did it. All of my persistent classes extend a common base class. So, I added a static Map to my base class:class Base
private static Map<String, Class<? extends Base>> classMap = null;
static
Map<String, Class<? extends Base>> map = new TreeMap<String, Class<? extends Base>>();
classMap = Collections.synchronizedMap(map);
public static Class<? extends Base> getClass(String name)
return classMap.get(name);
protected static void putClass(Class<? extends Base> cls)
classMap.put(cls.getName(), cls);
}And added a static initializer to each of my persistent classes:class Foo extends Base
static
Base.putClass(Foo.class);
}So now my persistence code can replace Class.forName("my.package.Foo") with Base.getClass("my.package.Foo"). Since Foo.class is of type Class<Foo>, this will give me the Class<Foo> I want instead of a Class<?>.
Basically, it works and I have no compiler warnings, but it is unfortunate that I had to come up with my own mechanism to obtain a Class<Foo> object when my starting point was the string "my.package.Foo". I think that the JDK, in order to fully support reflection with generic types, should provide a standard API for doing this. I should not have to invent my own.
Maybe it is there and I'm just not seeing it. Do you know of another way, using reflection, to get from a string "my.package.Foo" to a Class<Foo> object?
Thanks again for your help,
Gary -
How to Use iSetup to create new environment in copy of clean master.
Hi,
I want to use iSetup to create a complete new environment. No manual setup has been done yet in the copy of the master (no Business Group, No OU, no Chart of Acc: nothing). Source environment is being setup rightnow by functional consultants
Can one please provide me with a manual or guideline how to start this challenging job. Maybe a best practise can be used ?
In the end we want to setup an environment based on a clean master.
( practical data: eBS 12.1.2 on linux )
Thanks in advance
GuidoHi Guido,
You can get in touch with [email protected] who is the product manager for iSetup. He would able to assist you to go forward in the right direction. -
Hello ABAPers,
I have been using BAPI_PROJECT_MAINTAIN to create Project and WBS elements and I have done them without any errors.
Now I need help on how to create network activities.
Can anyone share on how to pass data to I_NETWORK table and I_ACTIVITY table and a brief description on what they are ?
Thanks in advance,
KiranHi Kiran,
Do the following steps
1.pass the following to i_method_project
method_project-refnumber = lv_refnum.
method_project-objecttype = 'NETWORK-ACTIVITY'.
method_project-method = 'UPDATE'.
concatenate aufnr(network nr) vornr(activity) into method_project-objectkey.
2.Into i_activity
activity-network = aufnr.
activity-activity = vornr.
3.i_activity_update
activity_update-network = 'X'.
activity_update-activity = 'X'.
It should work.If not let me know.
Rgds,
K.S. -
How to use cdrw to create multi-session cd?
I use cdrw to create multi-session cd as this:
# cdrw -O -i /tmp/1.iso
contents in 1.iso can be read by both Solaris and Windows, then
# cdrw -O -i /tmp/2.iso
Solaris consider the cd is empty and Windows consider the cd is not existed.
My question is, how to handle multi-session cd in Solaris? From some cdrecord FAQ, the data was there but TOC was broken, so one tip is importing TOC of previous sessions before burn. But how?Honestly I know this is sort of a weak point with Macs. Not really sure why. I guess with the price of HD storage getting cheaper as well as writable media it's just not something people are interested in enough. But that's too bad because it does seem to have interest.
Anyway you might check out Burn Again -
How to use LT03 to create TO by WBS delivery
Hi,
I have a WBS delivery, when I use LT03 to create a TO by this delivery, I can see the WBS field is empty, and gray. how to let me go ahead to create a WBS TO?
Thanks.If the LIPS fields don't have the special stock data, then your delivery is not related to special stock. Consequently, the TO cannot have special stock data too.
If you expected that project stock should be picked and issued through the delivery, it's better you check the preceding documents, master data and configuration, something may have gone wrong. -
How to use search index created by jhindexer
Hi i have created a JavaHelp set using Docbook which works ok but the search doesnt work. I then discovered jhindexer and have sucessfully used it to create a directory called index containing the index (DOCs,DOCS.TAB etc) in the same directory as the html files but it still doesnt work.
I guess i have to modify one off my javaHelp files (jhelpidx.xml,jhelpset.hs) to point to this index but cant find any info on this.
Can anyne help me please.place the snippet below into your HelpSet File (.hs), the helpset file should be in the same directory as the JavaHelpSearch folder where your index files are located. See the structure:
/foo.hs
/JavaHelpSearch/DOCS
/JavaHelpSearch/OFFSETS
---- snippet -----
<view>
<name>Search</name>
<label>Suche</label>
<type>javax.help.SearchView</type>
<data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
</view>
---- snippet -----
And read the supplied PDF documentation, because if you have problems with this, you will have even more problems with some more advanced stuff. -
How to use BAPI_REQUISTION_CREATE to create pr account cat is space
Hi expert !
I try to use BAPI_REQUISTION_CREATE to create PR which account cat is space (Inventory PR) but I found error commitment check that it seem I don't pass FUNDS and FUND_CENTER data but I pass it to table PRACCOUNTASSIGNMENT. IF I use BAPI_PR_CREATE, I can pass FUNDS and FUND_CENTER in Table PR_ITEMS and it can create PR but not commitment documents in FM Module. So I try to use BAPI_REQUISTION_CREATE instad because this BAPI can create PR and create commintment documents in FM Module.
Thanks ...Hi... Here is sample code that I found error commitment check...
report z_req_create.
DATA : T_REQUISITION_ITEMS LIKE BAPIEBANC OCCURS 0 WITH HEADER LINE,
T_RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .
DATA : E_NUMBER LIKE BAPIEBANC-PREQ_NO.
T_REQUISITION_ITEMS-DOC_TYPE = 'NB'.
T_REQUISITION_ITEMS-DEL_DATCAT = '1'.
T_REQUISITION_ITEMS-DELIV_DATE = '20020626'.
T_REQUISITION_ITEMS-PLANT = 'P1'.
T_REQUISITION_ITEMS-STORE_LOC = '01'.
T_REQUISITION_ITEMS-PUR_GROUP = 'P01'.
T_REQUISITION_ITEMS-MAT_GRP = '01'.
T_REQUISITION_ITEMS-PREQ_ITEM = 1.
T_REQUISITION_ITEMS-MATERIAL = '1MAT1'.
T_REQUISITION_ITEMS-QUANTITY = 10.
T_REQUISITION_ITEMS-PREQ_NAME = '123456'.
T_REQUISITION_ITEMS-PURCH_ORG = '1000'.
T_REQUISITION_ITEMS-ACCTASSCAT = ' ' . =====> Account Cat is space
T_REQUISITION_ITEMS-VEND_MAT = 'G'.
APPEND T_REQUISITION_ITEMS.
T_REQ_ACCOUNT_ASSIGNMENT-PREQ_ITEM = 1.
T_REQ_ACCOUNT_ASSIGNMENT-SERIAL_NO = 1
T_REQ_ACCOUNT_ASSIGNMENT-FUNDS_CTR = 'FUNDCENTER001'.
T_REQ_ACCOUNT_ASSIGNMENT-FUND = 'FUND001'.
APPEND T_REQ_ACCOUNT_ASSIGNMENT.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
EXPORTING
SKIP_ITEMS_WITH_ERROR =
IMPORTING
NUMBER = E_NUMBER
TABLES
REQUISITION_ITEMS = T_REQUISITION_ITEMS
REQUISITION_ACCOUNT_ASSIGNMENT = T_REQ_ACCOUNT_ASSIGNMENT
REQUISITION_ITEM_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SRV_ACCASS_VALUES =
RETURN = T_RETURN
REQUISITION_SERVICES_TEXT =
EXTENSIONIN =
REQUISITION_ADDRDELIVERY =
IF NOT E_NUMBER IS INITIAL .
WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
ELSE.
LOOP AT T_RETURN.
WRITE T_RETURN-MESSAGE.
ENDLOOP.
ENDIF. -
How to use session cookie property of System object?
Hi all,
I have searched all over the SDN but didnt get anything relevent so here i am posting my query...
My scenario is as follows:
I have created a KM document iview that launches an HTML page, on click of button of HTML page a VC iview is launched. On this iview i have a button that hits BI query.
PS: A system object is created for the connectivity bet portal and backend BI server.
PS: i have configured SSO between portal and backend.
Now when i click on button on iview that fetches the data from backend, i am asked for authentication pop-up, although i have configured SSO why i am asked to enter UID and PWD again??
In system object there is a property named
<b>"session cookie = MYSAPSSO2"</b>
So should i use this property so that cookie will get transfered from one session to other session when i click button on iview??
If yes then HOW??
Is there any other setting remained in Visual Admin?? or Backend or portal?
What could be the missing??
PS: User id are same on portal & backend.
Any help will be highly appreciated...
Regards,
Ameya
Thanks in advance
Message was edited by:
Ameya Pimpalgaonkar
null
Message was edited by:
Ameya PimpalgaonkarHi Ameya,
I do not know the exact answer.However you should look for something called JSESSION ID.
Have a look at the thread:
Re: Problems Using Application Integrator for BSP Application
Reg SSO Logon Tickets and Browser sessions
How to use jsessionid while making HTTP calls??
Hope you find something which can help you.
Regards
Atul Shrivastava
Maybe you are looking for
-
Firefox 4 will not open but returns to reboot request over and over how do I get past this?
I downloaded the Firefox 4 update and now can not open Firefox. I have had to go through google browser to reach Firefox. The screen keeps coming up with instructions to reboot after the download. I have done this several times. I can not find Firefo
-
How to copy files from a color classic w/broken floppy drive to an i-book ?
How to copy files from a color classic w/broken floppy drive to an i-book ? I have a Coplor Classic with a system 7. There is no ethernet on color classic. The floppy drive is dead. I need some important files I have on the color classic... How do I
-
Failed Battery - still Discharging
As titled, I'm having a battery problem with my HP MINI 2080-210nr. Recently the battery stopped working (would not power up the laptop), so now my netbook is a small desktop. The puzzling thing is, it is still discharging, as though the battery were
-
How to sync icalc with google calendar
Can anyone describe how to sync google calendar with iCal?
-
Hi, ive been experiencing the alleged CPU whine, and was wondering if apple will fix or replace my machine for a new one. Im under the 1 yr warranty.