I have a few classes such that:
public class XMLStatusMessage extends XMLMessage
{}
public abstract class XMLMessage implements IMessage
{}
public interface IMessageListener
{
public void onMessage( IMessage message );
}
public interface XMLMessageListener <T extends ...
|
So, I've been working on some playing cards in Java. (Not for any practical purpose really, I just enjoy playing cards and they're good practice) Now, right now, I'm ... |
I have an interface to describe when a class can create a "next" version of itself:
public interface Prototypeable<Type extends Prototypeable<Type>> {
public Type basePrototype(); // the zeroth raw instance of Type
...
|
So I am trying to make a parameterized type that will work for anytype in Java this includes anything that is an object, and also the primitives types. How would i ... |
In Java, am I able to extend from a generic supertype? According to this article, it looks like I should be able: http://www.ibm.com/developerworks/java/library/j-djc05133.html.
However, when I do something similar in ... |
I'm looking at some Java classes that have the following form:
public
abstract
class A <E extends A<E>> implements Comparable <E> {
public final int compareTo( E other ) {
... |
I'm looking at some code with this form:
1 package com.stackoverflow.java.questions;
2 import java.util.ArrayList;
3 import ... |
|
I am wondering if there's an elegant solution for doing this in Java (besides the obvious one - of declaring a different/explicit function. Here is the code:
private static HashMap<String, Integer> nameStringIndexMap ...
|
I have two classes which both extends Example.
public class ClassA extends Example {
public ClassA() {
super("a", "class");
...
|
My question is not easy to explain using words, fortunately it's not too difficult to demonstrate. So, bear with me:
public interface Command<R>
{
public R execute();//parameter R is the ...
|
I have
out.load(output, transactions, columnHeaders, dataFormat);
Where load is defined as:
public boolean load(String outputfile, List<Transaction> transactions, List<String> columnHeaders, String dataFormat);
and
String output = "";
String dataFormat = "";
ArrayList<ARTransaction> transactions = new ArrayList<ARTransaction>();
List<String> columnHeaders = ...
|
Simple Java generics question: I have two classes - one of which uses generics to define its type, the other which extends this class providing a concrete type.
public class Box<Item> {
...
|
Let the following code:
public abstract class MySuperClass {
public abstract void update();
/* ... ...
|
I have the following JAVA mess that is very unclear to me:
a generic Interface with two generic Types A and B, such as AIter<A,B>
another generic Interface with ... |
EDIT: There is another wrinkle in here that I missed that turns out to make a big difference. The method signature of doAnotherThing is instead the following:
<T extends Bar> T ...
|
I'm working on a evolutionary simulation model implemented in Java and ran into a key object-orientation design issue which I can't seem to work out. The problem can be summarized as ... |
As with many inheritance problems, I find it hard to explain what I want to do. But a quick (but peculiar) example should do the trick:
public interface Shell{
...
|
Greetings,
I am having a lot of issues during implementation of a model driven architecture. There is a specification for an information model, which makes use of generic types and inheritance. ... |
I have three classes:
public abstract class fileHandler<Key extends Object, Value extends Object> {
}
public A extends fileHandler<String, String[]> {
}
public B extends fileHandler<String, String> {
}
Now in my main function ... |
Possible Duplicate:
generics and inheritance question
Hi,
I have follwing theree classes:
public abstract class fileHandler <Key extends Object, Value extends Object> {
}
public A extends fileHandler<String, String[]> {
}
public ...
|
Possible Duplicate:
generics and inheritance question
my class hierarchy is:
class fileHandler<Key, Value> { }
class A extends fileHandler<String, String[]> { ... |
I have a list defined like this:
List<MyBean> beanList = getList();
getList() returns type List<MyBean>.
Now, I want to pass the result to a method that receives List<Idisplayable>
and MyBean does implements Idisplayable
This ... |
I'm trying to extend an abstract class with generics and I'm running into a problem:
abstract public class SomeClassA<S extends Stuff> {
protected ArrayList<S> array;
public SomeClassA(S s) {
...
|
I have 2 different types of data managers, one inherits the other and both rely on 1 base data class and looks like this:
public abstract class BaseDataType {
...
|
Lets say class C and D extend class B which extends class A
I have a methods in class E that I want to be able to use either an object C ... |
Possible Duplicate:
Extend from Generic Supertype?
Hi everyone.
I come from C++ and I loooved working with templates.
I would like, in Java, to "insert" a node into ... |
I am creating a small framework for a board game platform and I have created the following interfaces in order to be as generic as possible for the games that I ... |
The following code compiles but if I uncomment the commented line, it does not and I am confused why. HashMap does extend AbstractMap and the first line where map is declared ... |
How do you inherit from this class? The following code is broken but it shows what I'm trying to achieve.
Bound Mismatch: The type T is not a valid substitude for the ... |
I have a interface
public interface Doable<T,U> {
public U doStuff(T t);
}
I have an abstract class which implements Doable<T,U>
public abstract class AbstractDoable<T,U> implements Doable<T, U> {
...
|
I'd like to implement a schema which resembles Java's interface/implementor with generics pattern.
Say this would be a solution in Java:
public interface Option<E> {
getLimits<E>();
getValues<E>();
}
public class ...
|
I have some classes that look like this:
MODEL
public abstract class BaseEntity<O extends Object> { ... }
public class Person extends BaseEntity<Person> { ... }
COMMAND
public abstract class BaseCommand<BE extends BaseEntity<BE>> { ... }
public ...
|
I have this structure:
///Creep.java///
public interface Creep extends Movable<Position2D> {
...
}
///Movable.java///
public interface Movable<T extends Position2D> {
...
void setMovementStrategy(MovementStrategy<Movable<T>> movementStrategy);
...
|
How can I specify that I want any object that implements the A interface to be allowed inside of the List in a type-safe manner? I want to be able ... |
I'm trying to create a generic boradcaster to which client code may subscribe. Client code will then be updated (via the ReportListener) when any changes are mode to concrete Reporter_Abstract ... |
I have a problem with generics in Java in combination with interface inheritance.
Here is an exampe:
public interface Type0 { }
public interface Type1 extends Type0 {
void method();
}
public interface ...
|
In my current project, I have classes which are modeled like the following. At some point, a method like getReturnTypeForGetId() is called on classes A and B. Calling the method with ... |
I am using a fluent interface with inheritance. I declared the base class Constructor protected so you cant create a Foo<Bar> which would result in a ClassCastException on calling add(). But ... |
This is a nasty problem, and it might be that the design is just bad.
Writing a set of simple charts components (pie, bar & line charts) and am choking on some ... |
I'm looking for assistance on how to implement this Repository. Here's what I have so far:
public interface IEntity {
int getId(); //would rather not depend on int. fix ...
|
help! I have a nice class, Person, that is declared as follows: public class Person extends PersistentBusinessObject implements Cacheable {... with public interface Cacheable > {... It all works great. Now I want to subclass Person, say SmartPerson public class SmartPerson extends Person implements Cacheable {... which fails with Compiling 1 source file ... |
Hi Ranchers, Let's say I have a superclass, Bug, of which type my Caterpillar object is one. Great! What happens when my Caterpillar becomes a Butterfly or some other type of Bug that I haven't even thought of yet (assume I'm a geneticist)? How do I retain the benefit of polymorphism while redefining type? Use generics? If so, please describe a ... |
It sounds like what is being attempted is creating components (of arbitrary type) that already have built-in mouse event handling. This doesn't, to me, seem like a problem that is best solved using inheritance. I'd prefer to use composition. If there really is a need to have the same mouse-event handling on arbitrary JComponents, then it would be simple to inherit ... |
|
|
Does anyone know what causes this ? I am very surprised when I see how wide the range of possibilities with these generic types is, that something as simple as this would fail ?! I am using Eclipse 3.1.0, and also wondered if it wouldn't be the cause ? If this has some reason to be, is there a more elegant ... |
|