Generic interfaces

Given the interface and class below, why do I get an "unexpected type" error when I compile IncEnter?
public interface Funcion <T>
            public T aplicar(T n);      
public class IncEnter implements Funcion<int>
            public int aplicar(int n){
                        return n + 1;
Thanks!

Ok...
   public interface Funcion
      public int aplicar(int n);   
public class Doble implements Funcion
     public int aplicar(int n){
          return n + n;
public class Incrementar implements Funcion
     public int aplicar(int n){
          return n + 1;
public class Map1
     public void map(Funcion fun, int[] lista){
          for(int i=0; i<lista.length; i++)
               lista[i] = fun.aplicar(lista);
public class UsaMap1
     public static void main(String [] args){  
          int[] lista = {0,1,2,3,4,5,6,7,8,9};
          Map1 m = new Map1();
          Funcion f = new Incrementar();
          m.map(f,lista);
          for (int i=0; i<lista.length; i++)
               System.out.println(lista);
          System.out.println("---");
          f = new Doble();
          m.map(f,lista);
          for (int i=0; i<lista.length; i++)
               System.out.println(lista[i]);
          System.out.println("---");          
I want a generic version of the function map (which implies that "Funcion" must be generic too) and I don't know how to do it...

Similar Messages

  • Specialized vs. Generic Interfaces?

    Hi,
    I am new to these forums, please let me know if this is already part of a FAQ or not the appropriate place to ask this question.
    When designing an interface, would you recommend specialized or Generic Interfaces?
    As I am not sure if makes any sense, here are the two thinkings I have to define a myObject.getExportOptions() method that would return the ExportOptions that can be applied (i.e. "setCharacterDelimiter" for CSV export, "setHeader" for PDF, HTML....)
    Option 1:
    the code looks like:
      myObject.setExportMode(MICROSOFT_EXCEL);
      myExportOptions = (ExportOptionsExcel) myObject.getExportOptions();where the getExportOptions() would be defined as
    ExportOptions getExportOptions(); with the ExportOptions interface only defining all the common export options to all the export methods (PDF, Excel, HTML, Text...). And then to get to the export options that are specific to an export format, you would have to cast the object to a specific interface which extends the "generic" interface.
    Option 2:
    the code looks like:
      myObject.setExportMode(MICROSOFT_EXCEL);
      myExportOptions = myObject.getExportOptions();where the getExportOptions() would be defined as
    ExportOptions getExportOptions();with ExportOptions defining all the export options accross all the export methods (PDF, Excel, HTML, Text...). But if you tried to call the ".setExcelFormat(EXCEL_95)" method when the ExportMode is set to "TEXT_ONLY" then an exception would be raised (maybe something like "ExceptionNotApplicableToExportFormat").
    I did not find any document describing the prefered method of building this.... Any idea?
    Thanks,
    MonLand.

    I think I was not clear enough in my first message. Let me try to re-explain with a little bit more details (and more pseudo-code).
    Option 1:
    myReport.setExportMode(MICROSOFT_EXCEL);
    ExportOptions myExportOptions = myObject.getExportOptions();
    myExportOptions.setExportFileName("myReport"); // This would be common to any "export format" Now, for the "Excel" specific parameters, I would have to cast the options:
    ExportOptionsExcel myExcelExportOptions = (ExportOptionsExcel) myExportOptions;
    myExcelExportOptions.setExcelFileFormat(EXCEL_97);From the implementation point of view, I can have one "generic" ExportOption class/interface that contains all the common export properties. In addition, three or more classes that implement the specific export settings (one for Text_ONLY; one for MICROSOFT_EXCEL; one for PDF.....). From the developer point of view, to be able to set the "specific" properties, they have to know what interface to cast the export options to (because in the background, the reportObject class would create/return the "right" export options based on the export format that was set).
    Option 2:
    This time the ExportOptions is a much more generic interface and declares everything. But an exception is raised if I am trying to set parameters that don't make sense:
    myReport.setExportMode(MICROSOFT_EXCEL);
    ExportOptions myExportOptions = myObject.getExportOptions();
    myExportOptions.setExportFileName("myReport"); // This would be common to any "export format"
    myExportOptions.setExcelFileFormat(EXCEL_97);Now, if I was to do:
    myReport.setExportMode(TEXT_ONLY);
    ExportOptions myExportOptions = myObject.getExportOptions();
    myExportOptions.setExportFileName("myReport"); // This would be common to any "export format"
    myExportOptions.setExcelFileFormat(EXCEL_97);This last line would raise an exception (let's say "UnsupportedProperty") because the Text mode does not support the ExcelFileFormat property.
    From the implementation point of view, I can have three or more classes that implement the "ExportSettings" interface (one for Text_ONLY; one for MICROSOFT_EXCEL; one for PDF.....). But from the developer point of view, it does not matter with class gets used.
    Why I am asking: I am currently facing a design that looks like Option 1 and I can not figure out why this has to be that complex to use. Very hard to document if you replicate that design everywhere in a large API with a large number of objects/interfaces; you never know what to cast the object to; you never can guess what method you are looking for because you have to look at the definition of 3 or 4 interface at the minimum to see if you see something that fits your needs. So I am trying to understand if this is because it is much easier to implement that Option 2.
    I see the following drawback for Option 2: If you need to add an extra property to one of the export format, you probably have to update the "generic" interface, the "generic" implementation of that interface, and each "specific" implementation to reflect that new property.
    Thanks a lot for your time!
    MonLand

  • Writing generic interfaces?

    I would like to write a generic interface for a Factory. The implemented Factory should as minimum contain two methods that returns a List of "something" as seen below.
    But I don't want to put any restrictions on the return type since a user might want to use objects from his or her own API. Is the solution to just specify the interface as:
    public interface IReportFactory {
         List newProducts();
         List newTables();
    }

    Here's a small example to guide you. Good luck my friend...
    import java.util.*;
    public class Test
         public static void main(String... args)
              List<Product> prodList = new ArrayList<Product>();
              prodList.add(new Product("radio", 100)); prodList.add(new Product("Walkman", 50));
              List<Table> tableList = new LinkedList<Table>();
              tableList.add(new Table("customer", 100)); tableList.add(new Table("Product", 1000));
              Report r = new Report(prodList, tableList);
              System.out.println("Products\n----------\n"+r.newProducts());
              System.out.println("Tables\n----------\n"+r.newTables());
              System.out.println("\nChanging Structures to Vector and Stack\n");
              prodList = new Vector<Product>();
              prodList.add(new Product("radio", 100)); prodList.add(new Product("Walkman", 50));
              tableList = new Stack<Table>();
              tableList.add(new Table("customer", 100)); tableList.add(new Table("Product", 1000));
              r = new Report(prodList, tableList);
              System.out.println("Products\n----------\n"+r.newProducts());
              System.out.println("Tables\n----------\n"+r.newTables());
    class Product
         String name; double price;
         Product(String n, int p){ name = n; price = p;}
         public String toString(){ return "\nName = "+name+" & Price = "+price+"\n";}
    class Table
         String name; int numRecs;
         Table(String i, int v){ name = i; numRecs = v;}
         public String toString(){ return "\nName = "+name+" & # of Records = "+numRecs+"\n";}
    class Report<T, V> implements IReportFactory<T, V>
         T prodList;
         V tableList;
         Report(T prodList, V tableList)
              this.prodList = prodList;
              this.tableList = tableList;
         public T newProducts()
              return this.prodList;
         public V newTables()
              return this.tableList;
    interface IReportFactory<T, V>
         T newProducts();
         V newTables();
    }

  • Implementing two generic interfaces

    I have a generic interface,
    public interface Callback<R> {
       void result(R r);
    }Now I want to implement two Callback interfaces, like this
    class X implements Callback<Type1>, Callback<Type2> {
       public void result(Type1 r) {};
       public void result(Type2 r) {};
    }But Eclipse tells me "The interface Callback cannot be implemented more than once with different arguments".
    I don't see the reason why really. The two overloaded result methods have different signatures so there shouldn't be any problem in resolving the correct one based on parameter type in principle.
    Does anybody know the reason for this restriction or is it maybe an issue with Eclipse. I'm using Eclipse 3.2M5a and Java 6.0 beta.

    mlk has the correct answer, but here's some more explanation:
    Generics are only used at compile time. The actual bytecode specifies the base object type (aka type erasure), in this case Object. When you implement a generified interface, the compiler will generate a bridge method from the erased type to the specific type.
    Some examples should make this clearer.
    First, your interface. If you run javap on the compiled class, you'll see that it only defines a single method, "void result(Object)".
    Code that invokes the interface, like this:
        Callback<String> foo = \\
        foo.result("bar");also gets translated to a call on the base type. As far as the compiled class is concerned, there is no type safety. However, the compiler will complain if you pass something other than a String.
    The implementation class is where things get interesting:
    public class TestCallback implements Callback<String> {
      public void result(String x) {
    }If you run javap on this class, you'll see that it contains two implementations of result(): one that takes a String, and one that takes an Object. If you look at the bytecode, the latter performs a cast on the Object and invokes the String variant.

  • Generic Interface

    Hi
    I am working with a company which developed an application for procurement and selling to the client. My company has a
    client which is using Oracle E-business Suite R12 and want me to create an interface between the Procurement application
    ans Oracle E-business Suite R12. Now the requirement of my company is to develop a generic interface which can be used
    with any Oracle e-business Suite R12 instance regardless of the different setups. Can anyone give me an idea regarding the same.
    I am an Oracle E-Business Suite developer but the requirement seems new to me.
    Regards
    Ali

    I do not have many details about the generic interface you are planning to build, but you can refer to iREP/eTRM website for details about Oracle Procurement APIs.
    http://irep.oracle.com/index.html
    http://etrm.oracle.com/pls/etrm/etrm_search.search
    http://download.oracle.com/docs/cd/B53825_03/current/html/docset.html
    Thanks,
    Hussein

  • Enum implementing Generic interface

    Is there any way to implement a generic interface and specify the types for each enum
    public interfact IPrimaryKeyType<C extends Object> {
    public enum PrimaryKeyType implements IPrimaryKeyType {
    SINGLE,
    COMPOSITE,
    There is no way to specify the type for each enum element. Though you can specify the type for all enums as below.
    public enum PrimaryKeyType implements IPrimaryKeyType<Object> {
    SINGLE,
    COMPOSITE,
    Any ideas?

    The best way to answer questions like this is to look at the spec: http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9
    The answer seems to be that what you're trying to do is impossible.

  • Generic interface methods

    The problem is that I want a generic interface that has a method that returns type T. And concrete implementations specify the type T and the method body.
    Given the interface and class below, why do I get an unchecked conversion warning, and how do I eliminate it? Or is there an alternative?
    Warning displayed by eclipse:
    Type safety: The return type String of the method convert(String) of type AsciiStringConverter needs unchecked conversion to conform to the return type T of inherited method.
    This code compiles...
    public interface StringConverter<T>
        public T convert(String string);
    public class CharacterValueConverter implements StringConverter<int[]>
        public int[] convert(String string) //unchecked conversion warning
            int[] values = new int[string.length()];
            for (int i = 0; i < string.length(); i++)
                values=(int)string.charAt(i);
    return values;
    Thanks,
    C.

    Here is the code that is used to test the CharacterValueConverter...
    public class Test
        public static void main(String[] args)
            int[] values = new CharacterValueConverter().convert("abc");
            for(int i : values)
                System.out.println(i);
    }

  • How to refer to genericized interface

    Hi,
    I have the following interface:
    package org.tbiq.gwt.tools.rpcrequest.server;
    import org.tbiq.gwt.tools.rpcrequest.browser.RpcRequest;
    import org.tbiq.gwt.tools.rpcrequest.browser.RpcRequestException;
    import org.tbiq.gwt.tools.rpcrequest.browser.RpcRequestService;
    import org.tbiq.gwt.tools.rpcrequest.browser.RpcResponse;
    public interface RpcRequestHandler<ReqT extends RpcRequest<ResT>, ResT extends RpcResponse>
    public boolean isCompatibleWith(Class<ReqT> rpcRequestClass);
    public ResT execute(ReqT rpcRequest)
    throws RpcRequestException;
    }I also have a dummy implementation of this interface:
    package org.tbiq.gwt.tools.rpcrequest.server;
    import org.tbiq.gwt.tools.rpcrequest.browser.DummyRpcRequest;
    import org.tbiq.gwt.tools.rpcrequest.browser.DummyRpcResponse;
    import org.tbiq.gwt.tools.rpcrequest.browser.RpcRequestException;
    public class NewDummyRequestHandler
    implements RpcRequestHandler<DummyRpcRequest, DummyRpcResponse>
    @Override
    public DummyRpcResponse execute(DummyRpcRequest rpcRequest)
    throws RpcRequestException
    // TODO Auto-generated method stub
    return null;
    @Override
    public boolean isCompatibleWith(Class<DummyRpcRequest> rpcRequestClass)
    if (DummyRpcRequest.class == rpcRequestClass)
    return true;
    return false;
    }This interface refers to 2 dummy objects DummyRpcRequest and DummyRpcResponse. There is nothing special about them. They are just regular beans that implement marker interfaces (RpcResponse and RpcRequest<T extends RpcResponse>).
    DummyRpcResponse:
    package org.tbiq.gwt.tools.rpcrequest.browser;
    @SuppressWarnings("serial")
    public class DummyRpcResponse
    implements RpcResponse
    }DummyRpcRequest:
    package org.tbiq.gwt.tools.rpcrequest.browser;
    @SuppressWarnings("serial")
    public class DummyRpcRequest
    implements RpcRequest<DummyRpcResponse>
    }Somewhere else, I have a class that implements some other interface. Part of implementing that interface is this method:
    @Override
    public <T extends RpcResponse> T execute(RpcRequest<T> rpcRequest)
    throws RpcRequestException
    RpcRequestHandler<??????> handler = new NewDummyRequestHandler();
    return handler.execute(rpcRequest);
    }So, the '?????' is my question. How do I refer to the handler such that it compiles. Right now, now matter what I try in that line, the handler.execute(rpcRequest) doesn't compile.
    Also, it's possible that I messed up my RpcRequestHandler interface and defined it in a wrong way (as far as generics are concerned). I am not sure.
    Any help would be much appreciated!
    Thanks,
    Yaakov.
    P.S. The code in the last method is obviously for testing only. I am planning to have a Map of those handlers and choose the handler dynamically based on the type of the RpcRequest that is passed into the execute method.
    Edited by: ychaikin on Feb 23, 2010 1:10 PM

    Had a play round some more with this to refresh my knowledge, and understand exactly where you're coming from
    I don't know what your RpcRequest and RpcResponse interfaces look like - although since your concrete implementations DummyRpcRequest and DummyRpcResponse don't implement any methods, I guess that means that the two interfaces are blank.
    The fact that the RpcRequest takes a parameter of a subclass of RpcResponse, though, implies that there's some sort of relationship there. Perhaps, in future, you intend to have a method sig in RpcRequest that say, returns a subclass of (the type of RpcResponse you created the concrete implementation of RpcRequest with). It's hard to offer more suggestions without knowing exactly what you intend with this code.
    A handler takes a RpcRequest<RpcResponse>, runs its execute method, and somehow (depending on implementation) returns an RpcResponse.
    So I tested some code which I guess summarises your situation, and which works okay - if you want, you can blat this all into a file Test.java and compile/run it in textpad.
    interface Response {
         String message();
    class SpecificResponse implements Response {
         public String message() { return "Why hello there!"; }
    interface Request<E extends Response> {}
    /* This Request subclass stores a canned, fixed Response object. */
    class StoredResponseRequest<E extends Response> implements Request<E> {
         private E myResponse;
         public StoredResponseRequest(E useThis) {
              myResponse = useThis;
          public E getStoredResponse() {
              return myResponse;
    /* A handler <B, A> is able to take in a B (extends Request<A>), and return an A. */
    interface Handler<B extends Request<A>, A extends Response> {
         public A execute(B request);
    /* A HandlerForStoredResponseRequests works by assuming that all the Request<A>s it gets passed are, in fact,
         StoredResponseRequest<A>s. It therefore extracts the necessary A from the object and returns it.  */
    class HandlerForStoredResponseRequests <B extends Request<A>, A extends Response> implements Handler<B, A> {
         public A execute(B sreq) {
              return ((StoredResponseRequest<A>)sreq).getStoredResponse();
    class Test {
         public static void main(String[] argz) {
              Request<Response> request = new StoredResponseRequest<Response>(new SpecificResponse());
              System.out.println( execute(request).message() );
         public static <T extends Request<E>, E extends Response> E execute(T request) {
              Handler<T, E> stuffHandler = new HandlerForStoredResponseRequests<T, E>();
              return stuffHandler.execute(request);
    }

  • Generic interface in abstract super class

    hello java folks!
    i have a weird problem with a generics implementation of an interface which is implemented in an abstract class.
    if i extend from this abstract class and try to override the method i get this compiler error:
    cannot directly invoke abstract method...
    but in my abstract super class this method is not implemented as abstract!
    do i have an error in my understanding how to work with generics or is this a bug in javac?
    (note: the message is trown by the eclipse ide, but i think it has someting to do with javac...)
    thanks for every hint!
    greetings daniel
    examples:
    public interface MyInterface <T extends Object> {
       public String testMe(T t);
    public abstract class AbstractSuperClass<T extends AbstractSuperClass> implements MyInterface<T> {
       public String testMe(T o) {
          // do something with o...
          // now we have a String str
          return str;
    public final class SubClass extends AbstractSuperClass<SubClass> {
       @Override
       public String testMe(SubClass o)
          return super.testMe(o);
    }

    Hi Wachtda,
    Firstly, T extends Object is redundant as all classes implicitly extend the Object class.
    Therefore :
    public interface MyInterface <T> {
       public String testMe(T t);
    }Secondly, abstract classes may have both abstract and non-abstract instance methods. Also, two methods, one abstract and one non-abstract, must have a different signature.
    The following example will give a compile error because the methods share the same signature :
    abstract class Test {
         public void sayHello() {
              System.out.println("Hello");
         abstract public void sayHello();
    }Therefore, to make an interface method as abstract would simply block the possibility of implementing it.
    BTW, you can do this :
    abstract class Test {
         public void sayHello() {
              System.out.println("Hello");
         abstract public void sayHello(String name);
    }Finally, there's no bug in javac.

  • Help inheriting multiple generic interfaces of same type

    Hi-
    I am trying to re-factor some current code bloat.
    Here is the solution I want
    I want to define one generic subscriber interface, e.g.
    public interface Subscriber <TYPE> {
    public void valueChanges (TYPE T) ;
    And then I would like to (in theory) implements a class like this
    public class MyClass extends foo implements Subscriber<String> ,
    Subscriber <Integer> , Subscriber <Double> {
    public void valueChanged (String s) {
    public void valueChanged (Integer s) {
    public void valueChanged (Double s) {
    But this does not seem to be allowed becuase it says you can not inherit the
    same interface multiple times. I even tried something like this
    public interface Stringsubscriber implements Subscriber <String> for all the
    interfaces to specialize. That does not work.
    Can this be done (via some mechanism) in java or is this not possible.
    I am just learning the way generics work (I come from c++ world were templates
    are a bit more flexible and work a bit differently so its trying).
    Any hlep would be great.
    thanks in advance
    matt

    OK, Bruce, I'll bite: how do you attach
    parameterized types as annotation member values?
    There's no ".class" for them. It must be textual,
    , right? No.
    Actually I don't attach them as such, I put them somewhere else where I can find them by association.
    And you parse these stringual declarations
    later?The mirror API does not have an equivalent method to com.sun..javadoc.ClassDoc.findClass(String name), so you can't do it textually unless you require every type to be fully qualified. Thats too ugly for me.
    I tried writing a recursive annotation like this@interface Type {
        Class<?> value();
        Type[] args() default {};
    }but you can't write cyclic annotations (whose members are of its own type, directly or indirectly).
    So I thought that since I was annotating a class, I would just create some placeholder interfacesinterface S2WFGC1<T1> {}
    interface S2WFGC2<T1,T2> {}
    thru
    interface S2WFGC15<T1,T2,... T15> {}and do this
        @MyAnnotation(base=Map.class, add=@Flavor(EventDispatcher.class))
    class MyClass implements S2WFGC2<
                    Map<String,Integer>,
                    EventDispatcher<FooListener,FooEvent>
                > {
    }which gets interpreted as
        @MyAnnotation(
            base=Map<String,Integer>,
            add=@Flavor(EventDispatcher<FooListener,FooEvent>)
    class MyClass {}So I just put the raw type in the annotation, and for each of those (because the annotation is more complex than above), I get the type parameters from the S2WFGCn interface. I just use whichever S2WFGCn interface has the right number of type parameters.
    For each type in the annotation, if it is generic, I just read the next type argument from the S2WFGCn superinterface and use that instead (but error if its raw type is not the same as the annotation value). Each S2WFGCn actually extends S2WFGC, which makes it easy to find the S2WFGCn amongst (possibly other) superinterfaces.
    The S2WFGCn interfaces are sort of marker interfaces, but as well as having no methods, they also have no meaning. They are more like a variable for holding an array of types at the meta level.
    Sorry, but thats the best I can come up with. Its not pretty for sure, and I'd rather have a nicer mechanism, but for this application at least, the benefits are still positive, since in most cases there are no generic classes, so all the trickery disappears, and when there are generics, the ends justify the means.
    If only the JSR-175 EG had realised that generics was a meta type of the language...
    This was their biggest failure by a country mile.

  • Problem while using Generic interface.Help!

    package cn.com.landstar.violet;
    import java.util.*;
    interface ITextContainer implements Iterable<String>
         void append(String newStr);
         void clear();
         Iterator<String> iterator();
    the error messages point out that
    Line3 and Line9 need "{"and "}",

    interfaces can't implement anything, they can extend other interfaces.

  • Tutorial for make a non-generic type class from a generic type interface

    Hi there,
    How can I make a non-generic type class from a generic type interface?
    I appreciate if somebody let me know which site can help me.
    Regards
    Maurice

    I have a generic interface with this signature
    public interface IELO<K extends IMetadataKey>
    and I have implemented a class from it
    public class CmsELOImpl<K extends IMetadataKey> implements IELO<K>, Cloneable, Serializable
    then I have to pass class of an instance CmsELOImpl to AbstractJcrDAO class constructor whit below signature
    public abstract class AbstractJcrDAO<T> implements JcrDAO<T> {
    public AbstractJcrDAO( Class<T> entityClass, Session session, Jcrom jcrom ) {
              this(entityClass, session, jcrom, new String[0]);
    So I have made another class extended from AbstractJcrDAO. Below shows the code of this class and itd constructor
    public class ELODaoImpl extends AbstractJcrDAO<CmsELOImpl<IMetadataKey>> {
         public ELODaoImpl( Session session, Jcrom jcrom ) {
         super(CmsELOImpl.class , session , jcrom, MIXIN_TYPES);
    and as you see in its constructor I am calling the AbstractJcrDAO constructor by supper method
    then I got this error on the line of super method
    The constructor AbstractJcrDAO(class<CmsELOImpl>, session, Jcrom, String[]) is undefined.
    as I know java generics are implemented using type erasure. This generics are only
    in the java source file and not in the class files. The generics are only used by the compiler and
    they are erased from the class files. This is done to make generics compatible with (old) non generics java code.
    As a result the class object of AbstractJcrDAO<CmsELOImpl<IMetadataKey>>
    is AbstractJcrDAO.class. The <CmsELOImpl<IMetadataKey>> information is
    not available in the class file. As far as I understand it, I am looking a way
    to pass <CmsELOImpl<IMetadataKey>>, if it is possible at all.
    Maurice

  • Routing of messages to different interfaces via HTTP using one single URL.

    Hi all,
    I'm working on an inbound scenario. Messages are coming to SAP via HTTP adapter and i'm using a unique URL of every interface. But what is required is one single URL for all interfaces without any dropbox in PI, i.e. all messages will be pushed to one URL and i have to route them to their respective interfaces, there is no storage involved in PI box.

    Shamit2903 wrote:
    Hi all,
    >
    > I'm working on an inbound scenario. Messages are coming to SAP via HTTP adapter and i'm using a unique URL of every interface. But what is required is one single URL for all interfaces without any dropbox in PI, i.e. all messages will be pushed to one URL and i have to route them to their respective interfaces, there is no storage involved in PI box.
    logically this is not a possibility.
    But in case you are looking at a generic interface then you will have to handle this using;
    1.  a generic Data type to accommodate all required structures
    2. use conditional routing in configuration to execute further transformations.
    I wouldnt recommend this though.

  • Question about Java Generics

    Hello,
    I was wondering if there is any way to use multiple generics as you would use a list of arguments, for example
    Public void DoSomething(Object ...args)Could it be done the same with a generic interface?
    public interface Generic<T...>
       public void DoSomething(T args);
    new Generic<String,Integer>() {
        public void DoSomething(String arg1,Integer arg2) {
    new Generic<Class1,Class2,Class3>() {
       public void DoSomething(Class1 one,Class2 two,Class3 three) {
    }etc
    I am trying to do an event class, which would show me the required arguments for the event handler, instead of me having to document all the passed arguments (which are passed as Object... args)
    Here is my current class: Event and EventHandler class
    [http://pastebin.com/m252c65eb|http://pastebin.com/m252c65eb]
    Thank you in advance.
    Edited by: Naki on Jan 11, 2010 6:10 AM
    Edited by: Naki on Jan 11, 2010 6:13 AM

    Naki wrote:
    I am trying to do an event class, which would show me the required arguments for the event handler, instead of me having to document all the passed arguments (which are passed as Object... args)Why are they passed in as "Object..."? I assume you'll need to reference the concrete type anyway, so what's wrong with building a custom constructor in each concrete class that takes the correct arguments? You can still store them in an Object[] internally, if you really want.

  • Generic Data Sourse.. Doubts..

    Hi All,
    We are using Generic data source data is successfully extracted from view(application tables) and into BW Cube. But I want to see Datasource in RSA2 it shows a message
    <b>“ Data Source ZMYDATA_SOURCE does not exist in version A”</b>
    1 .Why it is coming? How to solve it ? It is not a business content. It is generic
    2. In Generic When we go for View/Table or Function module? Is there any Standard restriction is there?
    3. How to handle Delta in generic case?
    4. What is generic interface ( Blank , X) ?
    5. What is Direct access (D, 1, 2)?
    Please tell step by step.
    Thanks in Advance.
    Cheers,
    Sri

    Hi Dinesh,
    Thanks for ur response.
    1.In R/3 I went ROOSOURCE table and found no entry for  datasource. I checked that we are not using any remote cube.
    2. In RSO2 , When i enter Datasource: Message it shows:
      " Datasource is not defined in Source system"
    3. In RSA2 , When i enter Datasource: Message it shows:
       “ Data Source ZMYDATA_SOURCE does not exist in version A”
    What is the reason exactly?
    What should I do to resolve?
    Cheers,
    Sri.

Maybe you are looking for

  • Creative Cloud apps all stuck at 42% when installing.

    I'm not joking when I say it's been nearly 28hrs and I'm still trying to find out how this program pipeline can be so messed up. Look at it. That cold unfeeling 42% just sitting there, looking at me...mocking me. This happens with every CC app. I hav

  • How to give a value an Hyper link attribute

    Hi, I am pulling some data from the database and displaying on a report. One of the feilds in that report is the DATA. How can I give Hyperlink to that data value and then when I click on that DATA one of the SQL or PL/SQL script needs to be triggere

  • Multiple functions in one button

    Good evening, Is it possible to run multiple functions with one button? For example: With a button to open and close an object? Thanks 

  • I cannot scan and my hp solution says cannot run because device installation is not complete

    I am using windows 7 64 it. My printer is HP Photosmart eStation All-in-One Printer - C510a. I am using a wireless network and a notebook. Earlier my printer was not working, so I reinstalled the program using the cd, but now the hp solutions won't w

  • Installing Oracle on Cent OS

    Hi All, Can any one suggest me a document or steps relating to Installation of Oracle 10gr2 on Cent OS. Thanks in advance. Rajini.V