Strongly typed collection w genertics
I just started looking at the new features of 1.5, and generics specifically.
My question is, can I create a strongly typed collection using generics.
Assuming I have a java object call Car and want to have a collections of cars. I could do:
ArrayList cars = new ArrayList<Cars>();But what I would rather do is have the generic done within the collection class so that I just call:
CarCollection cars = new CarCollection();Thanks
Are you sure a Collection of Cars should know how to
get the total horsepower. Now it sounds like there
should be some other class that has a collection of
cars. Most (and by that I mean all with a few
exceptions) applications should never need a class
that extends a Collection class.
Most (and by that I mean all with a few
exceptions) applications should never need a class
that extends a Collection class.You cannot say that generally. Especially if you like the functional style of programming there are lots of nice things you can do with lists.
What's wrong with having a ListOfCars class offering operations on car collections as a whole? Like summing up this or that, or returning a new list according to a selection criterium, etcetera. Either the list itself does this or it offers a set of functors and filters you can apply.
A ListOfCars class represents a composite relationship. This doesn't mean it has to be implemented using composition (has-a). Design and implementation are separate things.
Similar Messages
-
Using a strongly typed ref cursor doesn't enforce data type
I am trying to enforce the datatypes of the fields coming back from an oracle reference cursor by making it strongly typed. However, there seems to be no warning at compile time on the oracle side or exception in ODP.NET if the datatype coming back in the cursor does not match. For example here is my cursor and proc
create or replace
PACKAGE THIRDPARTY AS
type pricing_record is record
BaseIndexRate number(6,5),
BaseIndexRateType VARCHAR2(1 BYTE)
type cur_pricing2 IS ref CURSOR return pricing_record;
PROCEDURE getpricingbyappidtest(appid IN application.intid%TYPE, pricing OUT cur_pricing2);
END THIRDPARTY;
create or replace
PACKAGE BODY THIRDPARTY AS
PROCEDURE getpricingbyappidtest(appid IN application.appid%TYPE, pricing OUT cur_pricing2)
AS
BEGIN
OPEN pricing FOR
SELECT somevarcharfield, someothervarcharfield
FROM application
WHERE A.appid = appid;
END getpricingbyappidtest;
I would expect this wouldn't compile since i am putting a varchar into a number field. But it does. Also if i check the datatype in the reader on the .net side it also is a string. So odp doesn't seem to care what type the cursor is
here is that code and output
var schemaTable = reader.GetSchemaTable();
using (var file = new System.IO.StreamWriter("c:\\_DefinitionMap_" + cursorName + ".txt"))
file.WriteLine("COLUMN" + "\t" + "DATATYPE");
foreach (DataRow myField in schemaTable.Rows)
file.WriteLine(myField["ColumnName"] + "\t" + myField["DataType"]);
COLUMN DATATYPE
BaseIndexRate System.String
BaseIndexRateType System.String
Does anyone have an approach for enforcing datatypes in a ref cursor? Am I doing something wrong when defining the ref cursor?Hello,
By using a ref cursor you are really using a pointer to a cursor. There is no way I know of to make a compile check of the cursor check unless you want to create a SQL type and cast the cursor to this type and even this wouldn't work in all cases. For instance, I could have function call within my cursor select which could return a varchar (with a number always in the varchar) which would be horribly sloppy but legal and you would expect Oracle to compile it.
If you are worried about this I would suggest not using ref cursors and go to UDT instead, where there will be more checking (because of a C# equivalence generated object). Oh and BTW, yes the cursor will throw an exception if the data is incorrect, but only at runtime - just like normal Oracle PLSQL.
Cheers
Rob.
http://www.scnet.com.au -
Workaround for opening a strongly typed cursor using native dynamic SQL
Hi All,
In reading the PL/SQL documentation for Oracle 9i, I noted that the OPEN-FOR
statement with a dynamic SQL string only allows the use of weakly typed cursors.
I have verified this limitation with my own experimentation as follows:
DECLARE
type rec_type is record(
str varchar2(40),
num number(22)
type cur_type is ref cursor return rec_type;
my_cur cur_type;
que varchar2(100);
tab varchar2(40);
BEGIN
tab := 'dynamic_table_name';
que := 'select key_name, key_value from ' || tab || ' where key_name like ''01%''';
open my_cur for que;
loop
if my_cur%found then
dbms_output.put_line('source_name: ' || my_cur.str || ', page_sn: ' || my_cur.num);
exit;
end if;
end loop;
close my_cur;
END;
Running the above trivial example in an anonymous sql block yields the following
errors as expected:
ORA-06550: line 10, column 8:
PLS-00455: cursor 'MY_CUR' cannot be used in dynamic SQL OPEN statement
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored
ORA-06550: line 13, column 54:
PLS-00487: Invalid reference to variable 'MY_CUR'
ORA-06550: line 13, column 7:
PL/SQL: Statement ignored
Is there a workaround to the situation? Since I do not know the table name at run
time, I must use Native Dynamic SQL. I have a long and complex record type
that I wish to return through JDBC using the REFCURSOR Oracle type in order to
avoid having to register an inordinate number of OUT parameters. Moreover, I
would like to return potentially one or more results in a ResultSet. Using the
standard method of registering native SQL types for the IN and OUT bindings
can only return one result. Hence the reason I would like to return a strong
cursor type. Also, the type of query I am doing is complex, and needs to be
executed in a PL/SQL procedure for performance reasons. Therefore simply
executing a SELECT query dynamically built up on the the JDBC client won't
do the trick.
If anybody has experience with a similar problem and would like to volunteer
information on their workaround, I would really appreciate it.
Best Regards,
J. MetcalfWe can use strongly-typed REF CURSORs in DNS, but the typing derives from a table e.g.
TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
so the problem is your use of "return rec_type" bit.
Forgive my bluntness but I think you have misunderstood strong and weak typing. You actually want to be using weakly-typed cursors. I mean this:
Moreover, I would like to return potentially one or more results in a ResultSet. suggests that the structure of your resultset may vary, which is precisely what a weakly-typed ref cursor allows us to do. Then we can use the JDBC metadata methods to interrogate the structure of the resultset, innit.
so try this:
DECLARE
type cur_type is ref cursor;
my_cur cur_type;
que varchar2(100);
tab varchar2(40);
BEGIN
tab := 'dynamic_table_name';
que := 'select key_name, key_value from ' || tab || ' where key_name like ''01%''';
open my_cur for que;
loop
if my_cur%found then
dbms_output.put_line('source_name: ' || my_cur.str || ', page_sn: ' || my_cur.num);
exit;
end if;
end loop;
close my_cur;
END;
ras malai, APC
Cheers, APC -
Weak and Strongly Typed Reference Cursors in Reports
Our custom reports has been using a reference cursor. I have inherited the code and not sure why there is a need to use a reference cursor when it can be done by a simple select statements. I see no dynamic select statements passed or any special parameters to reason out for use of reference cursor in our custom reports. Prior developers had reason out the benefits of using reference cursor for performance. I tested this by running a report with reference cursor versus plain select statement and still the report that is using the plain select statement performed better (faster) than the report that has the reference cursor, there is a big difference.
I have seen some disadvantage of using reference cursor on the reports that when there is a database object change even if the package that sourced the reference cursor has not been updated or modified the reports needs to be recompiled each time we get this error message coming from the report server queue:
Terminated with error: <br>REP-8: Run time error in the PL/SQL development
environment (DE). PDE-PSD001 Could not resolve reference to <Unknown Program Unit>
while loading <Unknown> <Unknown>. REP-0008: Unexpected memory error while
initializing preferences.In 9iAS reports prior version the error is occurring rarely. When we moved to 10.1.2.2.0 reports it appears the error occurs most often. We have made an effort to research about the issue and appears to be a bug. One suggestion is to use a strongly typed reference cursor. I have tried to researched about the difference between a weak and strongly typed reference cursor but failed to understand them. I appreciate any help about examples differentiating a weak versus a strongly typed reference cursors.
Thanks,
WarrenI guess my point, for what it's worth, is that whether you use only a strongly typed REF CURSOR, or whether you also use a weakly typed REF CURSOR, you may still end up getting the REP-0008 error (at least if your report is in .REP format). You can avoid this by using a pipelined function instead (or by putting the SQL directly in the report, or possibly by using .RDF or .JSP format).
To test this, you might:
1. Create a database package with an SQL*Plus script that that looks something like this:
CREATE OR REPLACE PACKAGE TEST AS
TYPE RECORD_TYPE IS RECORD
USERNAME ALL_USERS.USERNAME%TYPE
TYPE TABLE_TYPE IS TABLE OF RECORD_TYPE;
TYPE WEAKLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR;
TYPE STRONGLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR RETURN RECORD_TYPE;
FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE;
FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE;
FUNCTION GET_PIPELINED_TABLE RETURN TABLE_TYPE PIPELINED;
END TEST;
CREATE OR REPLACE PACKAGE BODY TEST AS
FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE
IS
cWeaklyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
BEGIN
OPEN cWeaklyTypedRefCursor FOR
SELECT USERNAME FROM ALL_USERS;
RETURN cWeaklyTypedRefCursor;
END GET_WEAKLY_TYPED_REF_CURSOR;
FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE
IS
cStronglyyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
BEGIN
OPEN cStronglyyTypedRefCursor FOR
SELECT USERNAME FROM ALL_USERS;
RETURN cStronglyyTypedRefCursor;
END GET_STRONGLY_TYPED_REF_CURSOR;
FUNCTION GET_PIPELINED_TABLE
RETURN TABLE_TYPE PIPELINED
IS
BEGIN
FOR rec IN
SELECT USERNAME FROM ALL_USERS
LOOP
PIPE ROW(rec);
END LOOP;
END GET_PIPELINED_TABLE;
END TEST;
/2. Create a report based on REF CURSOR query using only a strongly typed REF CURSOR. The PL/SQL statement that you use in the report as the data source for the query might look something like this:
function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
begin
return test.get_strongly_typed_ref_cursor;
end;3. Compile the report to a .REP file and run it to make sure it works as expected.
4. Drop and re-create the TEST package in the database.
5. Try running the .REP file again. I expect you will get the REP-0008 error.
6. Modify the REF CURSOR query to use an underlying weakly typed REF CURSOR by changing the PL/SQL statement (from Step 2) to something like this:
function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
begin
return test.get_weakly_typed_ref_cursor;
end;7. Repeat Steps 3 through 5. I expect you will get the REP-0008 error again.
8. Replace the REF CURSOR query in report with an SQL query that looks something like this:
SELECT * FROM TABLE(TEST.GET_PIPELINED_TABLE)9. Repeat Steps 3 through 5. I expect you will not get the REP-0008 error.
Hope this helps. -
New-variable to create strongly typed variable
In PowerShell to create a strongly typed I used to create strongly typed variable by typing Data Type in [] like [int]$a
Is there any way you can create a strongly typed variable using variable command-lets such as New-Variable or Set-variableThanks Boe
I know that it can be made strongly typed that way, All I wanted to know was can it be done via Command-lets
Unfortunately, it cannot be done using the *-Variable cmdlets. However, if you feel strongly that it should have this capability, feel free to log a Connect item asking for this as a feature in a future version. There are no promises that it will
happen, but it will at least make the product team aware of it.
Connect Site: https://connect.microsoft.com/PowerShell/Feedback
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book -
Why java is strongly typed language
Can any one help me to answer the following query:
(1)why java is strongly typed language?Can any one help me to answer the following query:
(1)why java is strongly typed language?http://en.wikipedia.org/wiki/Strongly-typed_programming_language -
Oracle ODP strongly typed dataset (runtime)
I am trying to use strongly typed Dataset Objects in my project but I seem to be missing something.
I created a class library project named DSCommon. I then used the Server Explorer to create an XML Schema of my Oracle table and then I generated a DataSet (http://www.developer.com/db/article.php/10920_3069061_2).
I then created a second windows application project and added a reference to DSCommon.
I have one text box, navigation buttons, and a command button on the form. I have tried the following code but I do not seem to have the benefits of a strongly typed dataset - I cannot do anything like txtPlaneType.text = ds.PlaneTypes[0].planedesc.
(I added a reference to Oracle.DataAccess to the windows app. project.)
<code>
Imports Oracle.DataAccess.Client
Imports DSCommon
Public Class Form1
Inherits System.Windows.Forms.Form
Dim conn As New OracleConnection
Dim cmPlaneTypes As CurrencyManager
Private Sub connectDatabase()
conn.ConnectionString = "User id=username;Password=password;Data Source=server.com;"
Try
conn.Open()
Catch ex As Exception
Throw ex
End Try
End Sub
Private Sub closeDatabase()
conn.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Me.connectDatabase()
Dim planeTypeAdapter As OracleDataAdapter = New OracleDataAdapter
planeTypeAdapter.SelectCommand = New OracleCommand("SELECT PLANETYPE, PLANETYPEDESC FROM PLANETYPES", conn)
Dim PlaneTypeDataSet As New PlaneTypes
planeTypeAdapter.Fill(PlaneTypes, "PlaneTypeDataSet")
cmPlaneTypes = CType(BindingContext(PlaneTypeDataSet, "PlaneTypes"), CurrencyManager)
AddHandler cmPlaneTypes.ItemChanged, AddressOf cmPlaneTypes_ItemChanged
AddHandler cmPlaneTypes.PositionChanged, AddressOf cmPlaneTypes_PositionChanged
txtPlaneType.DataBindings.Add("Text", PlaneTypeDataSet.PLANETYPES, "PLANETYPEDESC")
Catch ex As Exception
MessageBox.Show("At this time this information cannot be viewed or updated.", "Error retrieving records", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
If conn.State = ConnectionState.Open Then
Me.closeDatabase()
End If
End Try
' is this needed?
conn.Dispose()
end sub
</code>
This is the schema in the first project.
<code>
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="PlaneTypes" targetNamespace="http://tempuri.org/PlaneTypes.xsd" elementFormDefault="qualified"
xmlns="http://tempuri.org/PlaneTypes.xsd" xmlns:mstns="http://tempuri.org/PlaneTypes.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="PlaneTypes">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="PLANETYPES">
<xs:complexType>
<xs:sequence>
<xs:element name="PLANETYPE" type="xs:integer" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1"
msdata:AutoIncrement="true" />
<xs:element name="PLANETYPEDESC" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="DocumentKey1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:PLANETYPES" />
<xs:field xpath="mstns:PLANETYPE" />
</xs:unique>
</xs:element>
</xs:schema>
</code>
How do I create this at run time and get the benefits in design time?
Is there a better way to reference the code for the navigation buttons?<bump>
Can anyone from Oracle assist me with this issue? -
Return csv string as strongly typed ref cursor
I have a column in a table that is csv delimited and I want to return it (and others) as a strongly typed ref cursor.
eg
create table test_tab (mydata varchar2(100))
insert into test_tab(mydata) values ('"a1","b1","c1","d1"')
insert into test_tab(mydata) values ('"a2","b2","c2","d2"')
so test_tab has 1 column and 2 rows:
"a1","b1","c1","d1"
"a2","b2","c2","d2"
So a,b,c,d represent columns in my strongly typed ref cursor
If I then try something like:
declare
type my_rec is record(
a varchar2(50),
b varchar2(50),
c varchar2(50),
d varchar2(50)
type my_rec_refc IS REF CURSOR RETURN my_rec;
my_test_refc my_rec_refc;
begin
open my_test_refc for select mydata,mydata,mydata,mydata from test_tab;
end;
then it obviously works as my ref cursor is expecting 4 columns. However, what I want to do is break each individual element out of the mydata column. I've played around a bit with dynamic sql but only getting so far and apparently that can't be used with a ref cursor anyway. I need to return a strongly typed cursor as another program requires this.
One option is to manually parse each row and insert into temp table that is basically definition of record (so record type no longer needed) and this becomes type of ref cursor. I can then simply select from the table. I'm not keen on this as it's just another object to worry about.
Another option is to do some ugly instr/substr to extract each element in the sql statement (or write a function to do it but need to consider performance of this). The more generic the better as I need to reuse against multiple strongly typed ref cursors (kind of a contradiction in that by virtue of using strongly typed cursors I know exactly what I want returned!).
Another option is for someone to shed some light on this as it must be possible to do in a simple way along the same lines I have started?
thanks in advanceThat documentation seems to stay pretty vague. What constitutes the "right set of columns". Obviously my observed result matches what you are saying about not being able to enforce the datatypes in the fields of the strong typed cursor. But then I don't see the point of the strong typed cursor otherwise. Other sites i have read seem to focus on the %rowtype return rather than mapping it to a record. But the general consensus (at least to my understanding) is that if the cursor is strongly typed then the sql statement that used to open it must have the same set of columns and the datatypes must at least be able to implicitly convert.
I will try the %rowtype strong ref cursor against a table and see if there is a different result. I am mainly interested in this because I would like to beable to ensure the datatype returned on the .net side through ODP
I want to be able to know the datatype of a field coming back through a ref cursor at compile time not runtime. So it the answer to cast every field of the select statement? -
Caching WSDL, generating strongly typed web service classes
Hi All,
I come from an ASP.NET background. Visual Studio provides a
great tool for generating proxy classes based on a WSDL XML
document. What's so great about this is that you are able to have
strongly type classes (with intellisense in the IDE), compile time
type checking, and so forth.
What this means is that if I have a web service that defines
the method getColors, and takes two parameters; let's say an
enumerated type, "primary" or "secondary" for the first parameter,
and "hex" or "english" for the second parameter (also an enumerated
type), Visual Studio will generate a proxy class for me that will
give me type hinting. I'll see that the "getColors" method takes
two parameters, and it will even show the the possible values for
the enumerated type.
Is there anything like this in Flex?
-JoshHi Josh,
Flex Builder 3 includes the "Import Web Service (WSDL)"
wizard which is a tool that will generate proxy classes from a WSDL
file. This tool is included in the latest engineering drop, but is
not available in the latest beta build. You can access it via
File>Import>Flex>Import Web Service (WSDL) or by accessing
the Data>Import Web Service (WSDL)... menu option.
Plus, using the web services manager tool (accessible via
Data>Manage Web Services...) you can generate proxy classes for
more than one WSDL file by adding more WSDLs to your project,
remove the generated classes by deleting the WSDL from your project
or regenerate the proxy classes by using the Update option.
Using the proxy classes you benefit from code hinting of
operations the web service exposes, code hinting on the operation
parameters and their types, you get strongly typed results and
more.
Give these tools a try. We will appreciate any feedback
you'll provide. -
Can objects returned from web services be cast to strongly typed objects?
Can objects returned from web services be cast to strongly
typed objects?
Last I tried this was with one of the beta of Flex2 and it
did not work. You had to use ObjectProxy or something like that...
ThanksPlease post this question in the CRM On Demand Integration Development forum.
-
Revision: 5061
Author: [email protected]
Date: 2009-02-24 14:18:51 -0800 (Tue, 24 Feb 2009)
Log Message:
Changed the skin to use hostComponent rather than fxComponent so that binding happens on a strongly typed instance. By doing this we save the overhead of calling describeType() and doing RTTI. Also updated the backgroundColor to be cast to uint until the getter/setter is updated to return that (currently it is object)
QE: No
Doc: No
Checkintests: Pass
Reviewer: Ryan F & Glenn
Modified Paths:
flex/sdk/trunk/frameworks/projects/flex4/src/mx/skins/spark/FxApplicationSkin.mxmlRevision: 5061
Author: [email protected]
Date: 2009-02-24 14:18:51 -0800 (Tue, 24 Feb 2009)
Log Message:
Changed the skin to use hostComponent rather than fxComponent so that binding happens on a strongly typed instance. By doing this we save the overhead of calling describeType() and doing RTTI. Also updated the backgroundColor to be cast to uint until the getter/setter is updated to return that (currently it is object)
QE: No
Doc: No
Checkintests: Pass
Reviewer: Ryan F & Glenn
Modified Paths:
flex/sdk/trunk/frameworks/projects/flex4/src/mx/skins/spark/FxApplicationSkin.mxml -
Define custom typed collection class
Hi, I would like to define a custom typed collection class that can hold multiple type elements, to be more concrete, i have a class defined as
public class MyList extends ArrayList{
public class TestMyList{
MyList<MyDataTypeOne> listOne; // i want to use JAVA generics here, but it wont let me
MyList<MyDataTypeTwo> listTwo;
}and i got an error saying: "MyList" does not have typed parameters.
I understand that i need to declare my class as something like
public class MyList<MyDataTypeOne> extends ArrayList
but i dont want it to be restricted to <MyDataTypeOne> but multiple types, just like ArrayList. How can i cope with this please, thanks!Test the following code:
import java.util.ArrayList;
public class MyList<E> extends ArrayList<E>{
public MyList()
public static void main(String[] args) {
MyList<String> lista = new MyList<String>();
lista.add("Bolivia");
String x = lista.get(0);
System.out.println(x);
} -
Possible bug? JBO-25221 on action binding with typed collection.
I've noticed the following problem when using an action binding to an AM method that has a typed list parameter, eg: List<Long> instead of just List.
Create app module, then in the Impl class add a method, eg:
public void doSomethingWithList(List<Long> testList){ /* nop */ }and expose the method through the client interface in the app module. In a view page, drag the method from the Data Controls palette and create a Button from it ('value' in the edit binding dialog can be left blank).
When the button is accessed at runtime, the following is thrown:
<Utils><buildFacesMessage> ADF: Adding the following JSF error message: Method TestAppModuleDataControl.dataProvider.doSomethingWithList() not supported
oracle.jbo.InvalidOperException: JBO-25221: Method TestAppModuleDataControl.dataProvider.doSomethingWithList() not supported
at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:491)
at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:2134)
at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:3020)
at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:257)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1625)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2141)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:730)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)I've discovered that the problem is in the generated binding file:
<methodAction id="doSomethingWithList" RequiresUpdateModel="true"
Action="invokeMethod" MethodName="doSomethingWithList"
IsViewObjectMethod="false"
DataControl="TestAppModuleDataControl"
InstanceName="TestAppModuleDataControl.dataProvider">
<NamedData NDName="testList" NDType="java.util.List<java.lang.Long>"/>
</methodAction>If I remove the (apparently htmlchars converted) type info from the List, i.e. change that 'NamedData' line to:
<NamedData NDName="testList" NDType="java.util.List"/>Then it all works again.
(ADF 11.1.1.3.0, Vista x64)Hi,
the NDValue in the ADF binding does not support Generics yet. So its not working but still no bug. However, this reminds me to file an enhancement request for this support
Frank -
Object initializer syntax for strongly typed objects
Hi All,
In C#, you can initialize an object like this:
StudentName student = new StudentName {FirstName = "John", LastName = "Smith"};
I know that in ActionScript, I can create an object without an explicit type declaration using a similar syntax, like this:
var student:Object = {FirstName:"John", LastName:"Smith" };
But what if I wanted to strongly type the object I'm creating, like this:
var student:Student = {FirstName:"John", LastName:"Smith" };
That will fail with a compile error because I'm trying to convert a standard Object instance to a Student object instance.
Does ActionScript have a C#-like initializer syntax? Essentially, it gives you initialization constructors without you having to do the busy-work writing them. And, as an added bonus, you can initialize only the properties you want to, and you don't have to explicitly pass null for the properties you don't want to initialize.
-JoshNo such thing in AS. You could write a factory function if you want but it
won't be as efficient as constructors. -
What is Best Practice: Array or typed List?
Hello,<br /><br />I am just starting with BlazeDS and Flex. I want to exchange a strongly typed collection between client and server. I was wondering if it is better to use Java Arrays (MyClass[]) or typed lists List<MyClass><br /><br />What is the best approach? Are there differences?<br /><br />Thanks,<br /><br />Tobias
> What is the best approach? Are there differences?
Hi Tobias,
This probably falls under personal preference, but the List class is more
flexible (sizing, inserting in to the middle, etc) so I would prefer to use
it in Java. Actually, I might even go with ArrayList, that would split the
difference.
In any case, they would all translate to an ArrayCollection of types objects
on the Actionscript side, when your Actionscript classes have the right
'alias=' property set.
Tom Jordahl
Maybe you are looking for
-
How can I convert a number field in a to Date?
I have two columns in a table, and i would like to concate this two fiels to read Januaray-2010 CREATE TABLE "CATDB"."SC_DTL_MEASURE_DETAIL" "TIME_YEAR" NUMBER(*,0), "TIME_INCREMENT" NUMBER(*,0), )T
-
I want to call the WinAPI function-animatewindow in user32.dll to produce some special effect when showing or hidding windows, but i don't know how to using this Win API to achieve my purpose? Does anyone have an example VI about this application
-
I don't know my security questions...
I don't know my security questions and I can't figure them out. I tried looking at different pages and I still cant figure out where the link is to send an email to reset the questions. How do I reset them?
-
Get 5800 to use 802.11b even when the router suppo...
I wonder if there's a way to get the 5800 to use 802.11b mode WiFi although the router supports both 802.11b/g. I checked all the connection settings menus and even in the advanced connection settings but I didn't find a way to do this. So does anyon
-
Mobile Agent 7.5 Invalid Instrument
Hi, Can anybody help me diagnose my config issue for IPCC Error [12005} Login could not be performed - Possible casuses are Invalid Instrument ? This is my attempt to configure my first mobile agent using the following config: Sprawler 7.5 Device tar