Looking through some code I came across the following code
trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto));
and I'd like to know if casting this way has any advantages over
trTuDocPackTypdBd.update((TrTuDocPackTypeDto)packDto);
I've asked the developer responsible and he said he used it because it was new (which d...
I'm looking at some GXT code for GWT and I ran across this use of Generics that I can't find another example of in the Java tutorials. The class name is com.extjs.gxt.ui.client.data.BaseModelData if you want to look at all of the code. Here are the important parts:
private RpcMap map;
public <X> X get(String property) {
if (allowNes...
Are there any solutions or tools that transform java 5 code that uses all the new java 5 features(generics, autoboxing, varargs, static imports) into code that can run on a J2ME device? I am particularly interested in handling generics - the other features are nice to have but not mandatory.
I need source code as the result of this conv...
Java 5 has introduced many features that can be make logging statements less cluttering, such as variable number of arguments and printf. That can alleviate all the message building code that happens when something is logged, as well as the surrounding if.
For example, instead of writing:
if (log.isDebugEnabled()
{
log.debug("User ...
What is the easiest way to iterate over all the key/value pairs of a java.util.Map in Java 5 and higher?
...
Is there any way I can run class files (i.e. with main as the entry point) on JDK 6 that were compiled with Java 5?
...
Hi All,
I am getting confused as and when i come across a generic method of this sort?
public static <T> T addAndReturn(T element, Collection<T> collection){
collection.add(element);
return element;
}
The reason being is that i could not understand why is required in this method?
Also, I would be greatful to you if you can ...
I know similar questions have been asked many times befor, but I think this one slitly different :)
I'm writing a maven report plugin which will send emails to a list of users. I now have the problem, that the code seems to be working fine when I run it with java5, but failes with java6.
Actualy the plugin is writen in Groovy and uses t...
Hi,
normally I would use JaxB, XMLBeans or Simple to convert a XML file to a Java Object.
In this case I can however only use Java5 and no external libraries (for several reasons).
What is the best way to do that? My XML input is very simple. What is the most flexible and elegant way to get the XML into a Java-Object (I don't really ne...
I'm migrating from Java 1.1. to Java 5.
I notice that some methods have been deprecated e.g. java.util.Date has a getYear() method which is deprecated.
My question is if the getYear() method is left as it is in 1.1 will it still function in Java 5
...
I tried compiling my webapplication with javac – source 1.5 – target 1.4 I end up with the error:
javac: source release 1.5 requires target release 1.5
Since I’m using generics and other features; when I try compiling with –source 1.4 I end up with the errors:
(use -source 5 or higher to enable generics)
(use -source 5 or higher to en...
Possible Duplicates:
How and where are Annotations used in Java?
Java beans, annotations: What do they do? How do they help me?
Over and over, I read about Java 5's annotations being an 'advanced feature' of the language. Until recently, I haven't much used annotations (other than the usual @Override, &c), but work on a n...
Hey,
Can someone suggest me how to implement a pop-up window in Java Swing. I want the pop-up window to be a modal window (user cannot return to the main window when the pop-up is open).
I tried doing it using JDialog but it allows only one widget for user input to be in it whereas I need multiple widgets. I may be wrong here but this ...
Hello,
I have a JPA project which used to work. This month, I have added some data in my database. When I run the usual job (I used to run on preceeding months), I get this error:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal E...
I noticed the following in the Java Language spec in the section on enumerations here: link
switch(this) {
case PLUS: return x + y;
case MINUS: return x - y;
case TIMES: return x * y;
case DIVIDE: return x / y;
}
throw new AssertionError("Unknown op: " + this);
However, looking at the switch statement definition section, I...
Suppose we have a class called AccountService that manages the state of accounts.
AccountService is defined as
interface AccountService{
public void debit(account);
public void credit(account);
public void transfer(Account account, Account account1);
}
Given this definition, what is the best way to implement transfer() so that y...
Question is regarding Java 5 and Drag n Drop.
Is there a way to determine the drag source component in the drop target TransferHandler?
I need to know this in my canImport(..) or importData(..) method in order to take different actions for transfer data of the same type or DataFlavor.
The way I have achieved this currently is to hijac...
When I run FindBugs on my project via Maven, I get lots of these:
Can't use annotations when running in JDK 1.4 mode!
How do I fix that? Couldn't find anything in the manual.
...
I'd like to upgrade from Java 5 to Java 6.
We all know about the technical advantages and benefits, but:
I have the problem that a major client refuses to upgrade from java 5 to java 6 because of "the risks" and "no/too few benefits for us" (banking sector).
What can be answered to a non-technical decider at the client what benefits he...
I've looked through couple of articles here such as:
http://stackoverflow.com/questions/2124672/java-stack-dump-on-windows
http://stackoverflow.com/questions/239544/thread-dump-programmatically-jdi-java-debugger-interface
But didnt catch the exact answer.
The problem:
There is a Java5 Application on Windows that's runs as a service (...