Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Adam Richards

Ranch Hand
+ Follow
since Nov 03, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adam Richards

Well, I do use it elsewhere:

public MultiFacilityListPanel(final String id, final EnmPage parent,
final FacilitySearchByLocationCriteria criteria) {
super(id, parent, new MultiFacilitySearchDataProvider(criteria), criteria.getSearchType());
}

But this snippet isn't finished yet, because the data provider class won't compile (yet)
6 years ago
I have a class defined as follows:

public class MultiFacilitySearchDataProvider <T extends Facility & MilepostValue & Copyable<T>>

The class has this method:

protected T getFacility(final FacilityInstance instance) {

final MultiFacilitySearchDAO dao = new MultiFacilitySearchDAO(instance);
ENM.execute(dao);
return dao.getResultModel(); // Compile error here

}

The DAO method called above looks like this:

public MultiFacilitySearchModel getResultModel() {
return resultModel;
}

And MultiFacilitySearchModel is defined as follows:

public class MultiFacilitySearchModel implements Copyable<MultiFacilitySearchModel>, Facility,
Serializable, MilepostValue, MenuDisplayValues

The problem is that the line return dao.getResultModel() generates a compile error "Type mismatch: cannot convert from MultiFacilitySearchModel to T". I don't understand why I'm getting this error, since MultiFacilitySearchModel implements the three interfaces specified for the generic type T. What am I missing?
6 years ago
Sure, or wherever it makes sense or local policy dictates
9 years ago
Some general guidance on building libraries: Since a library is generally ignorant how it will be called, it can't make many assumptions on how to handle (or even if it should handle) errors. So as a general rule, I recommend not trying to catch very many exceptions in library classes (exept perhaps to display the message on System.out). Just pass along the exception to the calling app - only he knows the context & can make an informed decision on what to do with errors. Trying to to be too clever in error handling is a common beginner's mistake when developing API's for the first time.

9 years ago
Good luck learning Java, & don't feel self conscious about "dumb" questions. We see plenty of questions where one might wonder if the poster has been struck by lightning! I've fallen into that category from time to time myself.
9 years ago
Tip: You'll be getter responses if you use correct terminology. "Doubt" is the wrong word here. The right word would be "question" or "confusion," not "doubt."
9 years ago
The original post seems to have been edited to remove syntax errors. However, the stGo() method will still not execute, because it's never called from anywhere (at least, not in the code shown).
9 years ago
Just a general comment: I assume you know that you can't change the array size once it's declared. If the array size never needs to change, that's fine. But if the size is unknown at compile time, you're better off using a collection class like ArrayList; objects of this class can dynamically grow or shrink as needed at run time.
9 years ago
It you "bolded" a line, the forum software removed that style.

Your question is vague. Please be more specific. Is there a particular syntax or statement you don't understand?
9 years ago


Please post the exact error message & stack trace. If you're getting multiple, different errors, just post the first one & we'll work through them one at a time.
9 years ago
It's not clear what your objective is. If you're simply trying to see if there are ANY rows meeting a certain condition, you could do this directly in SQL, something like

SELECT NULL FROM table_name
WHERE EXISTS (.....)

This will return a row if they exist, no rows if not. If you want to PROCESS the rows, then you'll need to select some columns instead of just NULL.
Wow. Optional options. LIfe just doesn't get any better than that
THe other replies are correct--this "religious" debate's been going on for years. Some folk prefer Macs for ease for use, but if you go that route, be prepared to pay a hefty premium for the convenience. For some people the extra cost is worth it. For me, it's not: I think you get a lot more bang for the buck with a PC. IMHO.
9 years ago
Since I posted this, I realized the simpler way to do what I need is to specif a bundle attribute on the <html:errors> tag. The problem's a little complicated: I'm trying to incrementally convert a legacy app to a new error display style. So what I came up with is to use a separate resource bundle with the new errors.header and errors.footer strings. I think that will work, but now I can't get Struts to recognize that I'm deliberately creating an error (for testing). I'll start a new thread on that. But thanks for the quickly reply!
11 years ago