Instanceof Parameterized Type

Hello,
I have this function:
public final int compareTo(Object o)
    else if (o instanceof T)
            return compareTo((T)o);
}The problem is that the "else if" line gives me the following compilation error:
unexpected type
found : T
required: class or array
Does somebody know why I'm getting this error? T is a parameterized type so I should not have had any problem using the instanceof operator with it.
Thanks.

sorry bcoz I m not writing any reply to your message instead I wanted to contact you for my own problem. about two months ago you posted your problem of IllegalStateException: GL_VERSION I m facing the same one. I hope you have found out its solution kindly can you help me.

Similar Messages

  • Is it possible to compare two parameters type dateTime in switch- component

    Hello,
    i have a synchronouse prozess with one switch component. In the switch component i want to compare to parameters type dateTime. While execute the prozess alwayse the <otherwise>- sector is executed, but never the sector with the condition. But the condition is fulfilled.
    Can it be, that a comparison in a switch-component doesn't work while using two parameters with type dateTime?
    If it is so, has anybody an idea, how to compare two dateTimes without using the character dateTime?
    I'll be very happy about a helpfull advice.
    Thanks and regards,
    rala

    Hi Rala,
    this example works perfectly for me.
    IMHO doesn't matter how to assign values to dateTime variables.
    <scope name="Scope_timeDate">
    <variables>
    <variable name="aktCas" type="xsd:dateTime"/>
    <variable name="casDuration" type="xsd:dateTime"/>
    </variables>
    <sequence name="Sequence_1">
    <assign name="Assign_datesTimes">
    <copy>
    <from expression="xp20:current-dateTime()"/>
    <to variable="aktCas"/>
    </copy>
    <copy>
    <from expression='"2002-05-30T09:00:00"'/>
    <to variable="casDuration"/>
    </copy>
    <copy>
    <from expression="'before'"/>
    <to variable="rtn"/>
    </copy>
    </assign>
    <switch name="Switch_1">
    <case condition="bpws:getVariableData('aktCas') &gt; bpws:getVariableData('casDuration')">
    <assign name="Assign_ok">
    <copy>
    <from expression='"IF"'/>
    <to variable="rtn"/>
    </copy>
    </assign>
    </case>
    <otherwise>
    <assign name="Assign_otherwise">
    <copy>
    <from expression='"otherwise"'/>
    <to variable="rtn"/>
    </copy>
    </assign>
    </otherwise>
    </switch>
    </sequence>
    </scope>
    Regards,
    Ivan

  • Actual type of variable type in parameterized type

    Hi all,
    Is there way to find out what is actual type of the Variable type in Parameterized type, for example:
    class A<T> {
         //actual type of variable type T
         Class<T> tClass;
         public void setTClass() {
              // I don't know what should I do here
         public Class<T> getTClass() {
              return tClass;
         public static void main(String[] args) {
              assert((new A<Integer>().getTClass()).toString().equals("class java.lang.Integer"));
    Message was edited by:
    MjLaali
    Message was edited by:
    MjLaali
    Message was edited by:
    MjLaali

    yes ofcource I can't chenge the actual type of variable type T in run time, but I would like to get actual class of T in run time like this example :
    package test;
    import java.lang.reflect.ParameterizedType;
    abstract class B<T>{
         private Class<T> variableClass;
         public B() {
              this.variableClass = (Class<T>) ((ParameterizedType) getClass()
                        .getGenericSuperclass()).getActualTypeArguments()[0];
         public Class<T> getTClass(){
              return variableClass;
    class A extends B<Integer> {
         public static void main(String[] args) {
              assert(new A().getTClass() == Integer.class);
    but I don't want class A and I would like to move main method to class B.

  • Can Enum parameterized type implement an interface?

    I am trying to define a class that is parameterized with an Enum and the parameterized Enum must implement an interface. Here is some code:public interface MatchingEnum<E> {
        String match(); // This interface is not yet complete
    public class EnumField<E extends Enum<E> & MatchingEnum<E>> {
        private E enumeration;
        public EnumField(E enumeration) {
            this.enumeration = enumeration;
        private static class Test {
            EnumField<TestType> c;
        public enum TestType implements MatchingEnum<TestType> { One, Two, Three;
            public String match() {
                return null;
    }The problem is that the compiler complains that "classes cannot directly extend java.lang.Enum". If I delete the interface for the parameterized type(below) it compiles fine. Why can't the compiler handle this? Does specifying an Interface for an Enum bounds (E) force it to directly extend Enum? If so, why does the actual Enum compile?public class EnumField<E extends Enum<E>> {Blah, blah, blah... // This compiles
    public class EnumField<E extends Enum<E> & MatchingEnum<E>> {Blah, blah blah... // This does NOT compile

A: Can Enum parameterized type implement an interface?

Compiled from "EnumField.java"
public class com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField extends java.lang.Object{
public com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField(java.util.List);
  Code:
   0:   aload_0
   1:   invokespecial   #2; //Method java/lang/Object."<init>":()V
   4:   aload_0
   5:   aload_1
   6:   putfield        #1; //Field enumeration:Ljava/util/List;
   9:   return
public static void main(java.lang.String[]);
  Code:
   0:   new     #3; //class com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test
   3:   dup
   4:   aconst_null
   5:   invokespecial   #4; //Method com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test."<init>":(Lcom/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$1;)V
   8:   astore_1
   9:   getstatic       #5; //Field java/lang/System.out:Ljava/io/PrintStream;
   12:  new     #6; //class java/lang/StringBuilder
   15:  dup
   16:  invokespecial   #7; //Method java/lang/StringBuilder."<init>":()V
   19:  ldc     #8; //String t.m =
   21:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   24:  aload_1
   25:  getfield        #10; //Field com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test.m:Ljava/lang/String;
   28:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   31:  invokevirtual   #11; //Method java/lang/StringBuilder.toString:()Ljava/lang/String;
   34:  invokevirtual   #12; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   37:  return
static java.util.List access$100(com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField);
  Code:
   0:   aload_0
   1:   getfield        #1; //Field enumeration:Ljava/util/List;
   4:   areturn
}

Compiled from "EnumField.java"
public class com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField extends java.lang.Object{
public com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField(java.util.List);
  Code:
   0:   aload_0
   1:   invokespecial   #2; //Method java/lang/Object."<init>":()V
   4:   aload_0
   5:   aload_1
   6:   putfield        #1; //Field enumeration:Ljava/util/List;
   9:   return
public static void main(java.lang.String[]);
  Code:
   0:   new     #3; //class com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test
   3:   dup
   4:   aconst_null
   5:   invokespecial   #4; //Method com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test."<init>":(Lcom/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$1;)V
   8:   astore_1
   9:   getstatic       #5; //Field java/lang/System.out:Ljava/io/PrintStream;
   12:  new     #6; //class java/lang/StringBuilder
   15:  dup
   16:  invokespecial   #7; //Method java/lang/StringBuilder."<init>":()V
   19:  ldc     #8; //String t.m =
   21:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   24:  aload_1
   25:  getfield        #10; //Field com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test.m:Ljava/lang/String;
   28:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   31:  invokevirtual   #11; //Method java/lang/StringBuilder.toString:()Ljava/lang/String;
   34:  invokevirtual   #12; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   37:  return
static java.util.List access$100(com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField);
  Code:
   0:   aload_0
   1:   getfield        #1; //Field enumeration:Ljava/util/List;
   4:   areturn
}

  • Extending a parameterized type

    Hi,
    I have a Shape class like this
    public abstract class Shape<T extends Comparable<T> & Cloneable> {
    public abstract void draw( Graphics g );
    Now I extend it like this
    public class GraphicLine<T extends Comparable<T> & Cloneable> extends Shape{
    private int x, y;
    public void draw( Graphics view ){
    //TODO
    // Default ordering
         public int compareTo( T shape ) {
    It seems this depends on the combination of two things. The actual inheritance of the class (which is according to the old rules ) and the inheritance of the parameterized type.
    I want my shapes to be cloned and compared with other shapes. The line
    public class GraphicLine<T extends Comparable<T> & Cloneable> extends Shape
    is used because it seems to serve my purpose eventhough the line
    public class GraphicLine extends Shape compiles. I don't understand the difference though. I am guessing that the second line will lose the type constraint I have established in the super type ??
    My other doubt is the compareTo method. Can anybody comment on this ? I want my lines to be compared based on the start and end points. The code compiles.
    Thanks
    Mohan

    Thanks. Yes. I did that but still have doubts
    Does the line
    public class GraphicLine<T extends Comparable<T> &
    Cloneable> extends Shape<T>
    mean that T on both sides of the 'extends' keyword
    are linked ? Is that the reason why it is Shape<T>
    and not Shape< T extends Comparable<T>?Yes, now the T on both sides of the 'extends' is known by the compiler to refer to the same type. The class being extended uses the simple declaration in extended class declarations. It's important to realize that the bounds imposed on the args to the base class are passed on to all derived classes: if Shape expects that all of its parmtypes are Comparable, then there is no way for you to declare any derived class of Shape without passing on that restriction.
    Now my method is
         public int compareTo( T shape ) {
         GraphicLine<T> line = ( GraphicLine<T> )shape;
    and it compiles.
    It'll compile, but I'd be suprised if a call to this method ever succeeds: it appears at first glance that it'll throw ClassCastException every time. In your declaration, T is Comparable but GraphicLine is not. Your method requires an object that is Comparable and Clonable, and GraphicLappears to be neither. If you're expecting to compare GraphicLines, then that's what you need to declare in the interface of the compareTo method.
    public int compareTo( GraphicLine<T> shape ) { ... }

  • Extract WSDL operations and their parameters types

    Hello,
    I am working in a project and I need to extract information about the operations and their parameters types from a WSDL file
    could you please give me some code example on how to do that
    Thanks,
    labi

    By looking into WSDL4J I could not find how to handle the xml schema elements
    do you have any idea how can I get the complex data types information
    Thanks,
    labi

  • IMP 00022  failed to process parameters, type IMP HELP=Y for help TOAD

    Hallo!I am totally new to Toad.I would like to import data in csv format with 2,000,000 rows into an Oracle 11gR2 table.The database is hosted on HP-UX Itanium.I am using Toad 9.6.0.27 running on Windows 7 Professional.
    I have followed the instructions below to achieve this
    1.     Open DBA→Sql Loader Wizard
    2.     Choose "build a new control file". Next.
    3.     Click "Add". Choose your comma-delimited or tab-delimited file. Next.
    4.     Click "Add". Choose your table.
    5.     If you are loading a comma-delimited file, type a comma in the "all fields delimited by" combo box. If you are loading a tab-delimited file, select "TAB" from the "all fields delimited by" combo box. Next.
    6.     Choose a "load method" noting the following:
         TRUNCATE will erase whatever is in the table before loading.
         INSERT will insert data if table is empty but will return an error if table has any data in it.
         APPEND will insert data without deleting any existing data. You might get duplicates this way but it's a good method if you're trying to get that last line that somehow got munged for some reason or another.
    7.     If your file has column headers in its first row, type a 1 in the skip box. Next.
    8.     Type a control file name in the control file name box. Next.
    9.     Choose either "execute now" to load the data now or "just build the control file" to build the .ctl file. Once you have the ctl file theoretically you don't even need TOAD, as you could just use sqlloader on any machine that has sqlloader and can connect to the database. But why would you want to. :) I choose execute now.
    I have loaded SQL*Loader into Toad as below as I have Oracle 10g Developer installed on my machine
    Go to View - Options - Executables. Insert path to SQL*Loader utility (and any other you need/use), for example " C:\DevSuiteHome_2\BIN\imp.exe".
    Unfortunately,when I choose execute now,I get the errors below
    LRM-00101: unknown parameter name 'control'
    IMP-00022: failed to process parameters, type 'IMP HELP=Y' for help
    IMP-00000: Import terminated unsuccessfully
    How can I resolve this?Thanks.

    Thanks Hemant.I have selected the sqlldr file from <ORACLE_HOME>/bin from an Oracle 11gR2 installation in my client machine.However when I run the SQL*Loader from Toad,the error below appears
    SQL*Loader-500:
    Unable to open file (C:\ORACLE RESOURCES\charles csv excel files\CATM_CHECK_LEAVES_UPLOAD_BR009.dat)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: The system cannot find the file specified.
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    I am trying to load a .csv file into Oracle.Why is it asking for a .dat file?
    Please help.

  • What is the name of a nested parameterized type?

    The draft spec gives an example of a nested parameterized class Zipper<B> inside a parameterized class Seq<A>. In the sample code the nested type is refered to as Seq<String>.Zipper<Number>. Hence I concluded that the following should work either:
    package generics;
    public class RawTypes {
    private static class Outer<T> {
    public class NonstaticInner<T> {}
    public static void main(String[] args) {
    Outer[] x = new Outer<String>();
    Outer<String>.NonstaticInner<String> var = x.new NonstaticInner<String>();
    Instead the compiler complains:
    incompatible types
    found : generics.RawTypes.Outer.NonstaticInner<java.lang.String>
    required: generics.RawTypes.Outer<java.lang.String>.NonstaticInner<java.lang.String>
              Outer<String>.NonstaticInner<String> var = x.new NonstaticInner<String>();
    When I use the raw outer type the compiler is happy. Like in:
    Outer.NonstaticInner<String> var = x.new NonstaticInner<String>();
    But that is not what I want say.
    Why does this fail to compile? Because the outer class is a nested static class instead of a top-level class? That should not make a difference, I would think. What am I missing?
    Angelika

    I am quite surprised there is no reaction at your query.
    It made me so interested in the spec I downloaded it.
    At page 3 I read that no static meber could be parametrized.
    I think this makes the behaviour of the compiler correct.No, I don't think so. The spec says:
    "The scope of a type parameter is all of the declared class, except any static members or initializers, but including the type parameter section itself."
    The spec does not say that static members could not be parameterized. It just says that the type parameter of a generic class cannot be used in any static members of that generic class, be it a static method or a static initializer or the declaration of a static field or a nested static class.
    Stuff like this would be prohibited under the quoted wording:
    class X<T> {
    static T field;
    static T getField() { ... }
    static { T tmp; ... }
    static class Y { T t; }
    What I tried is not prohibited by anything in the spec, I believe. I simply defined a generic type (Outer) inside a nongeneric type (RawTypes):
    public class RawTypes {
    private static class Outer<T> {
    public class NonstaticInner<T> {}
    The weird thing is that the nested generic type RawTypes.Outer<T> behaves differently from a top-level generic type. Compare the above to the following:
    public class Outer<T> {
    public class NonstaticInner<T> {}
    According to the spec I would refer to the class nested into class Outer<T> as Outer<String>.NonstaticInner<Integer>, for instance. That's basically the example on page 4 of the spec, where they have a Seq<String>.Zipper<Number>.
    Why is the behavior entirely different when I want to refer to a class nested into RawTYpes.Outer<T>? Why can't I say RawTypes.Outer<String>.NonstaticInner<Integer>? Why do I have to name it RawTypes.Outer.NonstaticInner<Integer>? That does not make sense to me.
    A nested static type is like a top-level type, except that is has a name prefix. Why would that change with the addition of generics to the language?
    Outer.NonstaticInner<String> var = x.new
    NonstaticInner<String>();
    But that is not what I want say.What is it then that you want to say?
    Do you want to confine the valid values of var to outer classes parametrized with the
    String type? This will lead to problems (I think even with instances) as there is
    no specific type for a parametrized class.What error would you expect when a variable
    is passed having the correct "inner parameter type" but not the requested outer parameter type?I would expect the same error message that I would get when I assigned a Seq<String>.Zipper<Number> to a Seq<Integer>.Zipper<Number>. No?
    Maybe it's just a bug in the prototype compiler, but who can tell if the spec does not say much about nested types what their names would be.
    Angelika

  • Passing select-options parameters type to the class

    Hi All,
    I am creating one class and I want to pass the select-options parameters directly to it like s_plant,s_mtart etc .
    So while specifying these as paramters what type I should give them?
    Rgds,
    Madhuri

    Whatever you finally decide upon, you must have a Data Dictionary definition. So either create one for each type (bukrs, vkorg, etc.) or use a general one like RSELOPTION. However with the general one you have to put extra code in the class to convert back from a CHAR 45 field to your special field.
    Anyway, using the Data Dictionary is fun! So go create as many new tables as you need. In the long term, the work you do in the Data Dictionary is never wasted and it may save you time in the future when you need that structure / table again for a different program.
    Creating these structures and tables is easy if you use shortcuts. For example in local definitions in your program you can code...
    data range1 type range of bukrs.
    or
    data wa_bukrs type bukrs.
    ranges range1 for wa_bukrs.
    either of these gives you the structure... no need to manually type sign, option, low, high...
    What about Global (data dictionary) definitions? yes, there are also shortcuts...
    start transaction SE11, enter range table name in the 'Data' field (e.g. ZMYRANGETAB), Hit Create, choose to create a Table Type... now you are on the blank new Maintain Table Type screen. enter a short text for your new table, then choose
    Edit->Define as ranges table type
    next enter your data element (e.g. BUKRS) under 'data element', hit Save and activate. You just created your range table without manually entering sign, option, low, high...
    But wait there's more... on the same screen you can now (after saving the range table) also enter a structure name such as ZMYRANGE in the field 'structured row type'. Hit Create and you are taken to the Maintain Structure screen where the sign, option, low and high are already populated... add a short description and save and activate... you just created a workarea for your range table.
    You just created a table type ZMYRANGETAB and a structure ZMYRANGE with minimal effort.

  • Error in FM tables parameters type.

    Hi,
    I am creating a BAPI FM with the tables parameters with a parameter as
    i_ydrseg    type    MMCR_DRSEG.
    This is similar to the type as defined in the FM MRM_INVOICE_READ as
    T_DRSEG       TYPE     MMCR_TDRSEG.
    I have declared the MMCR as types pools in the function group TOP include of the new BAPI. But still i get the error as "  Type MMCR_DRSEG is unknown " .
    How do i create a table parameter of the type as above ?
    Pls help with your ideas.
    Thanks,
    Stock

    Hi again,
    1. just to make sure whether MMCR_DRSEG
       is working fine or not,
       and also the type pools is working fine in top include or not.
    2. do not use the parameter in import/export/tables parameter.
    3. Instead, for testing purpose,
    4. declare this in the source code of the FM,
       and check whehter it is giving error not.
    regards,
    amit m.

  • How to get instance of Class with its type parameters

    Hi,
    Have any of you folks been dealing with generics long enough to show me how this should be written? Or point me to the answer (I have searched as well as I could).
    I boiled down my situation to the included sample code, which is long only because of the inserted comments. And while boiling I accidentally came across a surprise solution (a bug?), but would obviously prefer a smoother solution.
    My Questions (referred to in the code comments):
    #1. Is there a way to get my parameterized type (classarg) without resorting to using the bogus (proto) object?
    #2. Can anyone understand why the "C" and "D" attempts are different? (All I did was use an intermediate variable????) Is this a bug?
    Thanks so much for any input.
    /Mel
    class GenericWeird
       /* a generic class -- just an example */
       static class CompoundObject<T1,T2>
          CompoundObject(T1 primaryObject, T2 secondaryObject)
       /* another generic class -- its main point is that its constr requires its type class */
       static class TypedThing<ValueType>
          TypedThing(Class<ValueType> valuetypeclass)
       // here I just try to create a couple of TypedThings
       public static void main(String[] args)
          // take it for granted that I need to instantiate these two objects:
          TypedThing<String>                        stringTypedThing = null;
          TypedThing<CompoundObject<String,String>> stringstringTypedThing = null;
          // To instantiate stringTypedThing is easy...
          stringTypedThing = new TypedThing<String>(String.class);
          // ...but to instantiate stringstringTypedThing is more difficult to call the constructor
          Class<CompoundObject<String,String>> classarg = null;
          // classarg has got to be declared to this type
          //    otherwise there will rightfully be compiler error about the constructor call below
          // This method body illustrates my questions
          classarg = exploringHowToGetTheArg();
          // the constructor call
          stringstringTypedThing = new TypedThing<CompoundObject<String,String>>(classarg);
       } // end main method
       // try compiling this method with only one of A,B,C,D sections uncommented at a time
       private static Class<CompoundObject<String,String>> exploringHowToGetTheArg()
          Class<CompoundObject<String,String>> classarg = null;
          /* Exhibit A: */
      ////     classarg = CompoundObject.class;
             results in compiler error "incompatible types"
             found   : java.lang.Class<GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = CompoundObject.class;
                                            ^
             I understand this.  But how to get the type information?
          /* It's obnoxious, but it looks like I will have to construct a temporary
              prototype instance of type
                 CompoundObject<String,String>
              in order to get an instance of
                 Class<CompoundObject<String,String>>
              (see my Question #1) */
          CompoundObject<String,String> proto = new CompoundObject<String,String>("foo", "fum");
          /* Exhibit B: */
      ////     classarg = proto.getClass();
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass();
                                            ^
          /* Exhibit C: */
      ////     classarg = proto.getClass().asSubclass(proto.getClass());
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass().asSubclass(proto.getClass());
                                                         ^
          /* Exhibit D: (notice the similarity to C!): */
      ////     Class tmp1 = proto.getClass();
      ////     classarg = tmp1.asSubclass(tmp1);
          /* It compiles (see my Question #2) */
          return classarg;
       } // end method exploringHowToGetTheArg()
    } // end class GenericWeird

    Thanks so much, Bruce. (Oh my goodness, how would I have ever come up with that on my own?)
    So in summary
    This doesn't compile:
          classarg = (Class<CompoundObject<String,String>>)CompoundObject.class;but these do compile:
          classarg = (Class<CompoundObject<String,String>>)(Class)CompoundObject.class;or
          Class coclass = (Class)CompoundObject.class;
          classarg = (Class<CompoundObject<String,String>>)coclass;And this doesn't compile:
           classarg = proto.getClass().asSubclass(proto.getClass());but this does:
           Class tmp1 = proto.getClass();
           classarg = tmp1.asSubclass(tmp1);

  • Eliminating type parameters used only for superclass information?

    I have a class called BaseObject. I have another class called Reference. A
    BaseObject has one canonical Reference that can be gotten and set. A Reference
    is capable of pointing at a BaseObject subclass of a particular type and can
    return the Class of that BaseObject subclass.
    I'd like to genericize these classes so that if you create a reference and
    assign it to an object, their types should line up. That is, a Reference that
    points to a Banana should not be able to be assigned as a canonical reference to
    a Cherry.
    My goal is to express these type constraints once somewhere. I cannot seem to
    achieve my goal.
    Pass one, which looks OK at the outset:
      public class BaseObject<T extends BaseObject> {
        public Reference<T> getReference() {
        public void setReference(final Reference<T> reference) {
      public class Reference<T extends BaseObject> {
        public Class<T> getObjectType() {
      }But that would mean that every subclass of BaseObject<T> would need to be
    declared with a type parameter as well to permit further subclassing, right?
    Like so:
      public class Fruit<T extends Fruit> extends BaseObject<T> {
        // Note: T is not used in this class except to "pass it up" to BaseObject
      public class Banana<T extends Banana> extends Fruit<T> {
        // Note: T is not used in this class except to "pass it up" to Fruit
        // Callers will have to say: new Banana<Banana>();
      }That seems WEIRD to me. Is there any way to...to...hide the genericization of
    the fundamental classes--BaseObject and Reference--without forcing the type
    parameters to be propagated all the way down the subclass stack?
    In other words, assuming a hierarchy of Object<--Fruit<--Banana, is there any
    way to have Fruit and Banana not mention type parameters at all?
    Thanks,
    Laird

    I'm up a creek here, aren't I?I think so. It's been a while since I complained
    about the lack of 'self-types' in Java. 'Self-type'
    actually means something different in other languages
    (Scala for example) so just be aware of that.AH! Yes! That's exactly what I'm talking about. OK, knowing that I'm screwed helps a lot, actually. It lets me know where I can and cannot apply generics to solve problems.
    I would envision:
    class BaseObject<self>
    // OR
    class BaseObject<T extends self>The idea would be that self is what ever the
    'current' class is. So if you used the first one,
    the type of the class that extended BaseObject would
    be assumed to be the parameteric type. The second
    one would require that the parameter (if present at
    time of variable of declaration is instantiation) be
    at least as specific as the current extenstion of
    BaseObject.Yes, exactly. This would be wildly helpful. Oh well.
    Back to 1.4 syntax.
    Cheers,
    Laird

  • SSRS Report with mutli select values in parameters

    Hi All,
    I am creating a SSRS report and displaying the result in tablix. I want to make the report to filter by multi select values from the parameters.
    I have 3 parameters. For all the three parameters, I have set "Default  Values" and "Available Values". Also, modified my result dataset to get the values from parameters using "WHERE ID = @Parameter1" (example) and so
    on..
    3 Parameters types:   1. Yes or No       
    2. Date          3. Values with NULL in the DB
    Problems:
    1. When I am passing the default values "Yes" "No" - it is throwing errors because default values is passed as Yes "AND" No instead of "OR" condition. The value stored in the DB wil have either Yes or No but not both.
    2. When I am querying the date values, it is a DateTime field in the DB. But I have queried like SELECT CONVERT(DATE, EXE_DATE) AS DATE FROM table which is giving only date in SQL but in SSRS displaying date with time.
    3. When I pull the list of values for third Parameter from SQL, it has some NULL values. When I try to use it in SSRS, it is not displaying the NULL value as select option in the list of values
    Any suggestions for the above three problems for SSRS with multi select values as filter will be helpful.
    Maruthu | My Blog

    Hi Maruthi,
    Regarding the three things:
    1.) I believe your first parameter is mutliselect , please convert it to single select.
    Steps: 
    a.) Select the parameter, right click and go to parameter properties
                    b.) Under General Tab in DataType section remove the checkbox for Allow Multiple Value.
    2.) Instead of returning as the date please return string. For example : 
    SELECT CONVERT(VARCHAR, GETDATE(),101)
    Here is the list of conversion : http://www.sqlusa.com/bestpractices/datetimeconversion/
    3.) As such there is no concept of null in SSRS. (Its a relational concept) . We do have nothing , which means empty. In Order to use null please select the Allow null option in the DataType section of the Parameter, This will add an checkbox for null in
    the report preview. Its developer job to handle the null values in there query.
    Regards Harsh

  • I am getting an error when I run parameterized java program in Eclipse 3.1

    When I tried to compile an example, java app, I this error.
    I checked, the jre it is using is 1.5.
    Could any one you suggest how to resolve this and why this problem?
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         The type ArrayList is not generic; it cannot be parameterized with arguments <String>
         Syntax error, parameterized types are only available if source level is 5.0
         The type ArrayList is not generic; it cannot be parameterized with arguments <String>
         Syntax error, parameterized types are only available if source level is 5.0
         Type mismatch: cannot convert from int to Integer
         Incompatible operand types Integer and int
    Code:
    http://www.anyexample.com/programming/java/java_arraylist_example.xml
         at Ex01.main(Ex01.java:13)
    Edited by: xmlcrazy on Aug 23, 2009 6:59 PM

    I got it. It is under windows/preference/java/compiler/compatibility. This fixes the problem.

  • Is there a forName() for java.lang.reflect.Type?

    Is there an equivelant to Class.forName() for all types?
    For example:forName("java.util.List<java.lang.Sring>");
    //or
    forName("int");Such a method would return a java.lang.reflect.Type, instead of return a java.lang.Class
    See also
    Field.getGenericType()
    Method.getGenericReturnType()

    incidentally, getGenericType() will give you the
    generic type of the member being examined, not the
    parameterized type.
    that is, if I declare a method like this:
    public <T extends MyInterface> T getStuff() {
    }I won't be able to reflectively find out what types
    of T are being used at runtime, only that it's of
    type 'T'. of limited use really
    Java's implementation of Generics isn't as good as it
    could be, mainly to maintain backwards compatibiityYou are right in that case because that is not a ParameterizedType that is a TypeVariable.
    Type can encompass both Types.

  • Maybe you are looking for

    • Material staging time in sales order

      Hi,   I was trying to implement work times for shipping point and came across this scenario. I have an order that is past due. I have moved in plenty of stock so that a MAD of today is possible. There is no pick pack/Loading or transportaion scheduli

    • Macbook and Windows Router

      Just wondering was going to purchase that new Mac Book and wanted to know if it can work with a rounter that has other windows computers on it.

    • Can Pair iPad 3 with Jambox but Can't Connect

      Before iOS6, I could connect my Jambox to my iPad 3 and listen to music or video. After iOS6 I can still pair them but cannot connect them. With iOS5, when I went to choose an audio output, my Jambox was one of the choices. Now, with iOS6, my choices

    • N97 Music Player

      Is there a better / alternative music player available anywhere for the N97? The default player is poor in my opinion - the player I had on my 2 year old Sony W960 was way ahead of this Nokia product. Simple things like being able to hide artists ass

    • Report help does not work

      We have generated a headstart online helpfile belhelp.htm All works fine when using online help with forms: the help text uses help context id and bookmarks in het htm file. Altough help text for all reports is generated in belhelp.htm, following err