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.
Similar Messages
-
Multiple DataSources of the same type (e.g. Peoplesoft Financials) in DAC
If I am definining multiple DataSources of the same type (e.g. Peoplesoft Financials) so as to extract data from multiple source ERP systems into a single DataWarehouse, should I have to define separate Data Source Numbers for each source database ?
I know the preseeded OBIA definitions provide different Data Source Number for Oracle Ebusiness Suite, Peoplesoft etc. But if I have the same ERP application and version in multiple source databases, how do I separate them ? Should I simply edit the Data Source Number and assign a new number to a new source ? Or do I have to copy some templates ?
Referring to Section 3.1.6 of the Oracle Business Intelligence Applications Configuration Guide (7.9.6.1).
Hemant K ChitaleHemant,
The purpose of DATASOURCE_NUM_ID is to identify which source it's from.
In the Warehouse a combination of Integration_ID and DATASOURCE_NUM_ID defines the uniqueness.
In your case the Source System and Verison is the same so its not required to have different DATSOURCE_NUM_ID
but if for traceability you want to have one it then you can define it.
My advise would be to have one Datsource Num ID as defined for your version and Source System. -
Transformation issue while connecting multiple source system of same type..
Hi,
I'm working on APO-BW integration project. I want to connect BW QA & BW PROD to APO QA. I've already connected BW QA to APO QA & it is fetching data correctly. RFC part & other BASIS part is already taken care of. I've done export datasource (for mater data, cube etc) in BW PROD & replicated in APO QA. All BW PROD datasources are imported as RSDS (7.X) in APO QA.
Now my question is how to make sure the transformations will take source system as BW PROD too? I want 2 datasources (one from BW QA & other from BW PROD) to connect to same inforprovider in APO. I've transported 7.x datsource from APO DEV to APO QA environment along with transformations. In conversion of logical system names in APO QA I've given source system -BW DEV & target system - BW QA. So the transformation automatically takes data source as BW QA. It doesn't take source-system - BW DEV & target system - BW PROD as it conflicts previous setting.
Is only option that I need to manually maintain transformation from BW PROD datasource or there's another better alternative?HI,
You are getting multiple IDOCs into BPM. But output you are getting one message right? IF so, your N:1 Mapping is not done correctly.
i.e your target message type should have occurence of 1..n and also the interface mapping. Closely obsever the N:1 mapping done in the BpmPatternCollectMerge.
Also go to SXMB_MONI->PE and check the Technical Details to make sure that, you are getting multiple IDOCs and you are executing the N:1 Transformation step correctly.
Also in the N:1 Mapping, check out the context you used. Make it root . Then test the mapping independently in the Integration Repository.
Hope it helps,
Regards,
Moorthy -
Please help! Multiple users accessing the same data sets
Hi all,
Can anyone provide a bit of insight in to a question I have?
We have two users that require to see the same set of data in the BPC Excel interface at the same time. The information is employees and date.
User 1 would like to see All Employee SignedData for 1 month, and User 2 would like to see just a slice of the Employees for 1 month.
If both of the Users are logged in at the same time, what will happen in terms of SAP 'locking' the data set? I am aware of Data Access Profiles to restrict their access to particular Master Data but there will be the requirement for users to see (maybe just in read-only), data that is shared between both Users.
Will it throw up an error or can I make it so that users have 'read only' access?
Any advice would be very much appreciated!
NickHi Nick,
No issue with that at all.
They can even both have write access. If they try to update the exact same record at the same time BPC will just keep writing Delta records.
User A enters 10
User B enters 20
User A refreshes and will get 20
User B refreshes and also gets 20 -
Help with multiple flash movies in same website
I'm trying to create a website in dreamweaver. I created the
artwork in fireworks. a slice of it i exported to flash to create
rolling clouds over the background. i also want in the same swf
file a screen for my main content. ( I used a scrollPane component
that works nice. But for each button on my web menu (home,
schedule, ect...), I want to be able to put new content in my
scrollPane. My buttons don't reside in my flash movie. Do I need to
create a new movie for each web page?
I'm not sure how to procede.
Can anybody help?
bradIt seems that when you import an external flash movie into
Captivate 1, the full path is...
"_level0.slide0__image_mc.s0_i9_swf_mc.m_swf_mc"
...this was the start of the solution for my problem so I
thought it best to post in case it helps out anyone else.
BTW - The slide number changes (obviously) and so does the
'i' reference depending on the attributes you have given to your
imported movies. -
Content conversion for multiple recordesets of the same type
Hi
I have a scenario where in i have the follwing structure
BXX
<>
HDR
<>
ITM1
<>
*TM2
<>
Now sometimes i get mutiple records like the following
BXX
<>
HDR (first occurance)
<>
ITM1
<>
ITM2
<>
HDR (2nd occurance)
<>
ITM1
<>
ITM2
<>
ITM3
<>
HDR (Third occurance)
*So now how should my content conversion be to achieve this.*>>Now sometimes i get multiple records like the following
What kind of source file you are getting? If this is a flat file, the structure should not come with multiple recordset in a single line.
You should get multiple lines. like below
BXX *** HDR1 *** ITM1 *** ITM2
BXX *** HDR2 *** ITM1 *** ITM2
BXX *** HDR3 *** ITM1 *** ITM2
If you are not getting structure like above, you should ask the source application to send in that way.
All applications i have seen give the structure i mentioned above.
The structure which you have mentioned comes in XML file. (one parent-multiple children)
Thanks
Aamir -
Need help - Loading Multiple instance of the same image
Hi guys,
I have been trying for days now, to get this working but i'm not able to do so, i have been trying to get actionscript to load multiple instance of an image file using a for loop.
Would anyone be able to enlighten me on this? the other functions are located on a seperate actionscript file.
many thanks
part of the code is as follows: (it works if i use the graphic class)
function makeRoad():void{
var row:int = 0;//the current row we're working on
var block;//this will act as the block that we're placing down
for(var i:int=0;i<lvlArray.length;i++){//creating a loop that'll go through the level array
if(lvlArray[i] == 0){//if the current index is set to 0
block = new EmptyBlock();//create a gray empty block
block.graphics.beginFill(0x333333);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
addChild(block);
//and set the coordinates to be relative to the place in the array
block.x= (i-row*22)*25;
block.y = row*25;
} else if(lvlArray[i] == 1){//if there is supposed to be a row
//just add a box that will be a darker color and won't have any actions
block = new Shape();
block.graphics.beginFill(0x111111);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
block.x= (i-row*22)*25;
block.y = row*25;
roadHolder.addChild(block);//add it to the roadHolder
} else if(lvlArray[i] is String){//if it's a string, meaning a special block
//then create a special block
block = new DirectBlock(lvlArray[i],(i-row*22)*25,row*25);
addChild(block);
for(var c:int = 1;c<=16;c++){
if(i == c*22-1){
//if 22 columns have gone by, then we move onto the next row
row++;@Kalisto - i don't think that is the real issue here since we cannot see what is in the DirectBlock class and the OP has not mentioned any compiler errors.
Desmond - it appears as though you are constructing this in the form of a 'grid' - correct? but the problem i believe is that the positioning is not being determined properly - to do something like you want here (i think) you would use what known as a 'nested loop' - this means the 'outer' loop handles iteration of the 'rows' and an 'inner' loop handles the iteration of the columns. the way you have this set up above, you are attempting to use the 'row' value to position both the row and column - this wont work and it's likely that everything is getting 'stacked' on top of one another.
may want to structure things a bit more like this:
function makeRoad():void {
var index:int = 0;
for(var row=0; row<22; row++) {
for(var col=0; col<22; col++) {
index = (row*22)+col;
if(lvlArray[index] == 0) createBlock(0x333333, col*25, row*25);
if(lvlArray[index] == 1) createBlock(0x111111, col*25, row*25);
if(lvlArray[index] is String) roadHolder.addChild( new DirectBlock(lvlArray[index], col*25, row*25) );
function createBlock(color, xp, yp):void {
var block:Shape = new Shape();
block.graphics.beginFill(color);
block.graphics.drawRect(0,0,25,25);
block.graphics.endFill();
block.x = xp;
block.y = yp;
roadHolder.addChild(block);
note: i do not know how many 'rows' you intend to have and are stored in the array so the row<22 will need adjustment -
Need help with generic class with comparable type
Hi. I'm at University, and I have some coursework to do on writing a generic class which offers ordered binary trees of items which implement the comparable interface.
I cant get the code to compile which I have written.
I get the error: OBTComparable.java uses unchecked or unsafe operations
this is the more detailed information of the error when I compile with -Xlint:unchecked
OBTComparable.java:62: warning: [unchecked] unchecked call to insert(OBTType) as
a member of the raw type OBTComparable
left.insert(insertValue);
^
OBTComparable.java:64: warning: [unchecked] unchecked call to insert(OBTType) as
a member of the raw type OBTComparable
right.insert(insertValue);
^
OBTComparable.java:75: warning: [unchecked] unchecked call to find(OBTType) as a
member of the raw type OBTComparable
return left.find(findValue);
^
OBTComparable.java:77: warning: [unchecked] unchecked call to find(OBTType) as a
member of the raw type OBTComparable
return right.find(findValue);
^
and here is my code for the class
public class OBTComparable<OBTType extends Comparable<OBTType>>
// A tree is either empty or not
private boolean empty;
// If the tree is not empty then it has
// a value, a left and a right.
// These are not used it empty == true
private OBTType value;
private OBTComparable left;
private OBTComparable right;
// Create an empty tree.
public OBTComparable()
setEmpty();
} // OBTComparable
// Make this tree into an empty tree.
private void setEmpty()
empty = true;
value = null; // arbitrary
left = null;
right = null;
} // setEmpty
// See if this is an empty (Sub)tree.
public boolean isEmpty()
{ return empty; }
// Get the value which is here.
public OBTType getValue()
{ return value; }
// Get the left sub-tree.
public OBTComparable getLeft()
{ return left; }
// Get the right sub-tree.
public OBTComparable getRight()
{ return right; }
// Store a value at this position in the tree.
private void setValue(OBTType requiredValue)
if (empty)
empty = false;
left = new OBTComparable<OBTType>(); // Makes a new empty tree.
right = new OBTComparable<OBTType>(); // Makes a new empty tree.
} // if
value = requiredValue;
} // setValue
// Insert a value, allowing multiple instances.
public void insert(OBTType insertValue)
if (empty)
setValue(insertValue);
else if (insertValue.compareTo(value) < 0)
left.insert(insertValue);
else
right.insert(insertValue);
} // insert
// Find a value
public boolean find(OBTType findValue)
if (empty)
return false;
else if (findValue.equals(value))
return true;
else if (findValue.compareTo(value) < 0)
return left.find(findValue);
else
return right.find(findValue);
} // find
} // OBTComparableI am unsure how to check the types of OBTType I am comparing, I know this is the error. It is the insert method and the find method that are causing it not to compile, as they require comparing one value to another. How to I put the check in the program to see if these two are of the same type so they can be compared?
If anyone can help me with my problem that would be great!
Sorry for the long post, I just wanted to put in all the information I know to make it easier for people to answer.
Thanks in advance
DavidI have good news and undecided news.
First the good news. Your code has compiled. Those are warnings not errors. A warning is the compiler's way of saying "I understand what you are asking but maybe you didn't fully think through the consequences and I just thought I would let you know that...[something] "
In this case it's warning you that you aren't using generics. But like I said this isn't stopping it from compiling.
The undecided news is the complier is warning you about not using generics. Are you supposed to use generics for this assignment. My gut says no and if that's true then you have no problem. If you are supposed to use generics well then you have some more work. -
Multiple DMVPN Instances on Same WAN Interface
Hi Folks,
Is it possible to run Multiple DMVPN Instances on a single WAN Interface ? Can we for example configure 3 Tunnels on a Router using one same WAN Interface but running separate EIGRP Instances for each Tunnel ? Kindly let me know , AliouneHi Alioune,
Yes you can create DMVPN as you said with one WAN interface that is possible..... you can have multiple tunnel interfaces pointed to a WAN interface as the source interface which resides in public zone..... with different public ip's as the destination tunnel...
interface Tunnel1
description ** A-VPN Tunnel **
bandwidth 100000
ip vrf forwarding red
ip address 10.0.252.2 255.255.255.252
no ip redirects
no ip unreachables
no ip proxy-arp
ip mtu 1500
load-interval 60
tunnel source GigabitEthernet0/0 (WAN Interface)
tunnel destination 1.1.1.1
tunnel protection ipsec profile dmvpn
interface Tunnel1
description ** B-VPN Tunnel **
bandwidth 100000
ip vrf forwarding red
ip address 10.0.252.5 255.255.255.252
no ip redirects
no ip unreachables
no ip proxy-arp
ip mtu 1500
load-interval 60
tunnel source GigabitEthernet0/0 (WAN Interface)
tunnel destination 2.1.1.1
tunnel protection ipsec profile dmvpn
like the above..... shown sample...
Please rate if the given information helps!!! -
Two Interface with same IDOC sperated by Document Type
Hi All,
I have Two interface which is for RFQ and Purchase order, bother uses same IDOC orders05, i need to indentify which one for which interface using Document type for purchase NB and and AN for RFQ , please help me to slove this isssue , hope we muct use Context object for this , but i dont know how to use it , please help me
thanking you
SridharHi,
Can you explain a bit about your scenario, coz I think it can be handle in other way without using context objects..
But if you want to use the context object, then you can add it in Message Interace ---> Context Objects, and in ID while doing RD you can find it under Condition Editor ---> take F4 help and then select context objects.
Regards,
Sarvesh -
Different EBS Adapter interfaces generate same object types differently
Hi,
We are experiencing the following behavior when using two different interfaces that are both generated from the E-Business Suite Adapter.
Wrapper packages and object types are generated and created in the database. But in both cases the generator creates a type called gme_api_pub_rowtype_sql1.
Alas, that same type has a different specification depending on the interface. Hence, one of the api's has compile errors as it expects the type to have additional parameters.
Has anyone experienced the same behavior?
More important: is there a way to overcome the problem?
Thanks, SjoerdTo add to that:
We are not willing to have separate schemas for each of the EBS Adapter interfaces so that we can have multiple instances / occurrences of type gme_api_pub_rowtype_sql1, i.e. one per schema.
This would quickly turn into a maintenance nightmare.
Thanks, Sjoerd -
I want to print multiple copies of the same photo on a page. The directions in help don't work
HelpWhat version of iPhoto?
The general process is to select the photo and print, select the printer, paper size and print size and click customize and under settings selec multiples copies of a photo (the preview will reflect this choice) and click print to print, make any printer specific selections and click print to print
LN -
Multiple inheritance in remote interfaces for EJB 3.0 session beans on Webl
Hi All,
We started migration from EJB 2.1(WLS 8.1) to EJB 3.0(WLS 10.3.2) and identified few serious problems. One of them is related with multiple business interfaces inheritance. I wrote simple example that presents point of the problem.
we have session bean AImpl:
+@Stateless(name="A")+
+@Remote({A.class})+
+@TransactionAttribute(TransactionAttributeType.REQUIRED)+
+public class AImpl implements A {+
+@Override+
+public void writeA() {+
System.out.println("A");
+}+
+@Override+
+public void writeB() {+
System.out.println("B");
+}+
+@Override+
+public void writeC() {+
System.out.println("C");
+}+
+}+
with remote interface A:
+@Remote+
+@JNDIName(A.JNDI_NAME)+
+public interface A extends B, C {+
public static String JNDI_NAME = "A_JNDI_NAME";
void writeA();
+}+
As you can see A extends B, and C. Definition of both interfaces is very simple:
+public interface B {+
void writeB();
+}+
+public interface C {+
void writeC();
+}+
Everything looks nice until we want to invoke some method on AImpl bean. For above implementation code:
A a = ctx.lookup(A. JNDI_NAME);
a.writeA();
a.writeB();
a.writeC();
writes down ”A \n B” and throws exception:
caused by: java.lang.NoSuchMethodException: pl.gov.arimr.zszik.bazowe.slowniki.ejb.A_vt0zts_AImpl_1032_WLStub.*writeC()*
at java.lang.Class.getMethod(Class.java:1605)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:165)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:57)
so.. in stub generated by WLS there is no method from interface C ! What more interesting after small change in interface A rely on change in interface implementation order from B, C to C, B (+public interface A extends C, B {+) server writes down only A and I have stack like below:
Caused by: java.lang.NoSuchMethodException: pl.gov.arimr.zszik.bazowe.slowniki.ejb.A_vt0zts_AImpl_1032_WLStub.*writeB()*
at java.lang.Class.getMethod(Class.java:1605)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:165)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:57)
After this experience I came up with suspicion that Weblogic 10.3 does not support inheritance from multiple interfaces in one “generation”. Instead of that it takes only the first interface from the list.
Does anybody have some experience with such a situation? maybe someone have an idea how to work around this problem?This is Not Supported in WebLogic that the Remote Interface extends other Interfaces. Because Annotation Processor just looks up inside the implemented interface methods. The actual interface which is Implemented by the Bean Class. So the Methods declared inside the Interface B and Interface C will be ignored and will not be available as part of the generated Stubs. Thats why u are getting NoSuchMethodError.
You can even contact Oracle Support on this...there are 3-4 Cases on it. And the Solution is Work As Designed.
Workaround is : edit your interface A as following
Declare all the Business Methods only in the Remote Interface and not inside it's Super Interfaces.
Example:
@Stateless(name="A")
@Remote({A.class})
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class AImpl implements A {
@Override
public void writeA() {
System.out.println("A");
@Override
public void writeB() {
System.out.println("B");
@Override
public void writeC() {
System.out.println("C");
@Remote
@JNDIName(A.JNDI_NAME)
public interface A extends B, C {
public static String JNDI_NAME = "A_JNDI_NAME";
void writeA();
void writeB();
void writeC();
Thanks
Jay SenSharma
http://jaysensharma.wordpress.com (WebLogic Wonders Are Here) -
Multiple inheritance in tagging interface? Is it possible?
I saw a code somewhere that goes like this:
public interface Node extends Serializable, Clonable
...Is it possible? I know that Java doesn't allow multiple inheritance and that Serializable and Clonable are tagging interfaces where no method must be implemented by the programmer.KamenRiderZX wrote:
I know that Java doesn't allow multiple inheritanceMore exactly: Java doesn't allow multiple inheritance of implementations. Inheriting multiple interfaces ("implements" for classes, "extends" for interfaces) is fine 'though. -
Hello GW experts,
we have defined a Function Import "CreatePOWithReference" with a parameter "Reference" which contains a string with information about a reference document which shall be used to create a new Purchase Order (PO):
Now I would like to pass not only a single reference but multiple reference all of the same type "Reference".
I tried calling the function import with two references like this:
/sap/opu/odata/sap/ZMP_ODATA_PO_SRV/CreatePOWithReference?Reference='123'&Reference='456'
But in method "/IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION" my parameter table "IT_PARAMETER" only contains 1 single record:
How can I achieve that the table "IT_PARAMETER" contains two records (Reference='123' and Reference='456')?
Thanks and best regards,
Oliver
PS: As there can be any number of references, it is not an option to create several parameters "Reference1", "Reference2", "Reference3" and so on... .Hello Thomas,
In my opinion, i do not think you can pass same property multiple times as you are trying now. I really doubt if GW supports this and IT_PARAMETER has only one Reference ( which is sent 1st i.e., 123 ) as you have already shared values read at runtime.. As per my understanding it is the correct behavior of GW where only one reference number - 123 is present in IT_PARAMETER table.
Other standard way of accomplishing your business case would be implementing CREATE operation and operate it on BATCH.
Regards,
Ashwin
Maybe you are looking for
-
Classic starts up, apps won't...
I used the Classic environment successfully fairly recently, and I don't recall any major changes to my system. But just yesterday my wife told me she couldn't get Word to start up. So I tried myself and nothing worked in either of our accounts. I th
-
Hi Friends, Portal system was down, just rebooted the server. No changes were made in Backend system. Please suggest. Here the log file for refrence. stdout/stderr redirect node name : server0 pid : 2616 system name : EQ7 system nr. : 03 s
-
Reg:- Customization of ESS Benefits Enrollment Page
Hi All, I have a requirement to customize the <b>Overview</b> page of <b>Add/Change Dependants and Benefeciaries</b>. I need to change the text of the buttons, "<b>New Father</b>", "<b>New Mother</b>", "<b>New Child</b>" and "<b>New Emergency Contact
-
Social sharing on Announcements
Hi Guys... I have a news area section on my clients site that is still in development. http://welcome-rt.businesscatalyst.com/company/latestnews I've been trying to implement the facebook and twitter modules into the annoucement layouts but they aren
-
Enable XBRL in 11.1.1.3
Hi, Can anyone guide me on how to achieve the following in Hyperion 11.1.1.3 Enable the functionality of XBRL in Financial Reporting, Upload the taxonomy into "xbrlfile" folder, and Finally upgrade the schema and context in Financial Reporting Studio