Created
November 30, 2009 14:15
-
-
Save timfel/245463 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class AbstractListView<S extends IDescribable> extends ViewPart implements ISelectionListener { | |
public java.lang.Class<?> getGenericType() { | |
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass(); | |
java.lang.Class<?> rawType = (java.lang.Class<?>) parameterizedType.getRawType(); | |
Type actualType = parameterizedType.getActualTypeArguments()[0]; | |
TypeVariable<?> typeVariable = rawType.getTypeParameters()[0]; | |
return (java.lang.Class<?>) actualType; | |
} | |
public Classifier getGenericTypeClassifier() { | |
try { | |
return (Classifier) ((java.lang.Class).getGenericType()).getDeclaredField("CLASS").get(getGenericType()); | |
} catch (IllegalArgumentException e) { | |
e.printStackTrace(); | |
} catch (SecurityException e) { | |
e.printStackTrace(); | |
} catch (IllegalAccessException e) { | |
e.printStackTrace(); | |
} catch (NoSuchFieldException e) { | |
e.printStackTrace(); | |
} | |
return null; | |
} | |
} | |
/** | |
* This is a general view with a search/filter box that will contain a | |
* {@link ListComposite} | |
*/ | |
public class ListView<ModelType extends IDescribable> extends AbstractSearchableListView<ModelType> { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment