Object Node created inside class Node
public static class Node
protected static final Node EXTERNAL= new Node();
Can somebody do this? Shouldn't you first define a class and then create an object of it?
Thanks
Can somebody do this? I suggest you try it and find out.
Shouldn't you first define a class and then create an object of it?Yes.
The class is created when you compile the code.
The object is created when you run the program.
So there is no problem.
Similar Messages
-
Creating custom class instances for XML nodes
Hi guys,
I'm trying to load an external XML document in my application
and create an instance of a custom class for each node in the XML
based on the value of some of their elements. The instances created
will eventually end up in a DataGrid by the way. The problem I'm
having is there seems to be many ways of doing small parts of this
and I have no idea how to make them all gel. Initially I'm using
HTTPService to load the XML file but I've seen people just use an
XML object. Then, after that, I initially set the loaded XML to an
ArrayCollection but others have used XMLList or XMLListCollection.
I've no idea what's the best way to do this.
Eventually, when I've created all of these instances by
looping over the XML and creating them how will I make them
bindable to the data grid? I'm guessing I'll have to group them
somehow...
Any help would be greatly appreciated. ThanksHey Tracy,
That is exactly what I was talking about in a previous post
you replied to
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1344350
Anyhow, Below is some code I created to do what your saying
somewhat dynamically. The idea being you can have many different
object types that you may want to populate with data from XML. In
my case I am using e4x as the result type from my web services. At
present I have about 6 different classes that call this function.
I'd love to get some opinions on the function. Good bad or
???? Any improvements etc????
package . . . .
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
import mx.utils.ObjectUtil;
* Utility class to convert xml based Objects to class
instances.
* Takes a value object as the destination and an xmlList of
data
* Look through all the items in the value object. Note we
are using classInfo..accessor since
* our objects are bound all variables become getter /
setter's or accessors.
* Also note, we can handle custom objects, arrays and
arrayCollections.
* History
* 03.11.2008 - Steven Rieger : Created class
public final class XMLToInstance
public static function xmlToInstance( destinationObject :
Object, sourceXMLList : XMLList ) : void
// Get the class definition in XML, from the passed in
object ( introspection so to speak )
var classInfo : XML = describeType( destinationObject );
// Loop through each variable defined in the class.
for each ( var aVar : XML in classInfo..accessor )
// If this is String, Number, etc. . . Just copy the data
into the destination object.
if( isSimple( aVar.@type ) )
destinationObject[aVar.@name] = sourceXMLList[aVar.@name];
else
// Dynamically create a class of the appropriate type
var className : String = aVar.@type;
var ObjectClass : Class = getDefinitionByName( className )
as Class;
var newDestObject : Object = Object( new ObjectClass());
// If this is a custom type
if( isCustomType( className ) && ObjectClass != null
// Recursively call itself passing in the custom data type
and the data to store in it.
// I haven't tested nested objects more than one level. I
suppose it should work.
// Note to self. Check.
xmlToInstance( newDestObject, sourceXMLList[aVar.@name] );
else
// Must be some sort of Array, Array Collection . . .
if( ObjectClass != null )
var anXMLList : XMLList = new XMLList(
sourceXMLList[aVar.@name] );
for each( var anItem : XML in anXMLList )
// I'm sure there are more types, just not using any of them
yet.
if( newDestObject is Array )
newDestObject.push( anItem )
else
newDestObject.addItem( anItem );
// Add the data to the destination object. . . .
destinationObject[aVar.@name] = newDestObject;
} // end function objectToInstance
public static function isSimple( dataType : String ) :
Boolean
* This function is pretty self explanatory.
* Check to see if this is a simple data type. Did I miss
any?
* History
* 03.11.2008 - Steven Rieger : Created function
switch( dataType.toLowerCase() )
case "number":
case "string":
case "boolean":
return true;
return false;
} // end isSimple
public static function isCustomType( className : String ) :
Boolean
* This function is pretty self explanatory.
* Check to see if this is a custom data type. Add them here
as you need. . .
* History
* 03.11.2008 - Steven Rieger : Created function
var aClassName : String = className.replace( "::", "."
).toLowerCase();
aClassName = aClassName.substr( aClassName.lastIndexOf( "."
) + 1, aClassName.length - aClassName.lastIndexOf( "." ) );
switch( aClassName )
case "ndatetimevo":
case "expenselineitemvo":
return true;
return false;
} // end isCustomType
} // end class
} // end package -
BRF+ Deleting functions within object nodes
Hi Experts,
We are a large FMCG company and are implementing SAP Master Data Governance module for managing our material master data.
Hence, we have chosen BRF+ as the business rule engine to drive SAP MDG. SAP MDG version is EHP5
To create a ruleset, I initially create an object node within the 'Trigger tab' in the catalog. This object node is created with a naming convention DERIVE_ENTITY_ATTRIBUTE. I have then successfully created a function within the object and defined a ruleset as well.
Now if I delete the object node; it gets deleted from the trigger function tab. However if I create a new object node with a similar function, the system does not allow me to create the function as it throws a warning message stating that the function still exists.
Hence I wanted to know HOW DO I DELETE THE FUNCTION if the Object node for that function has already been deleted?
Is there any option to search the function and delete it?
Thanks in advance
Edited by: Reenav on Nov 29, 2011 12:29 PMHi Carsten,
Where do you actually restore an object though? I don't see a button on the UI.
I have deleted an object by mistake, but since I don't have versioning turned on I cannot do a version restore. However I can still see the deleted object since it's only logically deleted?
If you do not have versioning turned on is it then impossible to restore?
Thanks,
Lee -
Unable to expand table (or 'any' object) node - permissions issue?
I am the dba for a database and hence have access to the system user. When I connect to the db through SQL Developer, I can expand the table node under any user and list tables. As I can with any object node.
I now want to create an admin user that has restricted capabilities, one of which will be to view objects, such as tables etc..
(I will ultimately do this via a role to allow multiple users to have the admin capabilities, but for now have just created an admin_user userid).
However, when I connect to the database using this admin_user userid, I am unable to expand any object node.
I have played with different permissions, granting 'select any dictionary', 'select_catalog_role', 'select on dba_tables' but the user still can not view any objects via the appropriate node. eg. attempting to go to Other Users - username - Tables just shows nothing. (There are no filters).
However the admin_user can run a SQL command to view the tables. eg. Select * from dba_tables, will list all tables for all users within the database. So they DO appear to have the appropriate access.
So why can't they see the tables in the tables node?
Is there some piece of configuration within SQL Developer itself that I have overlooked?
CheersI am the dba for a database and hence have access to the system user. When I connect to the db through SQL Developer, I can expand the table node under any user and list tables. As I can with any object node.
I now want to create an admin user that has restricted capabilities, one of which will be to view objects, such as tables etc..
(I will ultimately do this via a role to allow multiple users to have the admin capabilities, but for now have just created an admin_user userid).
However, when I connect to the database using this admin_user userid, I am unable to expand any object node.
I have played with different permissions, granting 'select any dictionary', 'select_catalog_role', 'select on dba_tables' but the user still can not view any objects via the appropriate node. eg. attempting to go to Other Users - username - Tables just shows nothing. (There are no filters).
However the admin_user can run a SQL command to view the tables. eg. Select * from dba_tables, will list all tables for all users within the database. So they DO appear to have the appropriate access.
So why can't they see the tables in the tables node?
Is there some piece of configuration within SQL Developer itself that I have overlooked?
Cheers -
How to create an object within the same class???
hi im just a newbie
i v been always creating an object from the main class..
but how to create an object inside the same class??
i got main and students class
the main got an array
Students[] stu = new Students[]
and i got
stu[i] = new Students(id,name);
i++;
but i wanna do these things inside the Students class..
i tried ..but i got errors.....
how to do this
.javaexpert, :)
I really have no idea what you are trying to do since you say you've always been creating an object from the main class, yet you always want to create an object inside the same class.
I'll assume that you have an object in the main class that you are trying to access from the Students class.
If you are trying to access objects that are contained within the main class FROM the Students class, then know that there are two ways of doing so, one being static, and the other dynamic (look up definitions if unclear):
1.) make the objects in the main class both static and public and access the the objects using a convention similiar to: Main.object; It's important to note that Main is the name of your main class, and object is a static object. There are better ways of doing this by using gettter/setter methods, but I'll omit that tutorial.
2.) Create a new instance of the main class and access the objects using a similiar fashion: Main myInstance = new Main(); myInstance.myObject;
You should really use getter and setter methods but I'll omit the code. In terms of which approach is better, step one is by far.
I don't mean to be condecending, but you should really brush up on your programming skills before posting to this forum. This is a fundamenetal concept that you will encounter time and time again. -
Assignment of Materials to Cost Object Nodes in Cost Object Hierarchy
We have defined a Cost Object Hierarchy. In the Cost Object Hierarchy , there are multiple cost object nodes. These cost object node represents each Prodcution line.
There is a requirement that any material can be produced in any production line.
The issue I am facing is if I am assiging one material to one Production line, and again if I am trying to assign the same material to other production line, the system is not allowing me to assign it.
How Can I resolve this issue.
kindly help.
regardsHi
Ideally, each prod line should be represented by a Production Version in PP... You can assign a combination of Material + Prod Version to each Cost Obj Node... You cant assign just a Material No to more than 1 node
The Prod Version Field might appear in Grey Mode.. But, it will allow you to select the Prod Version in that Field....
You can also use BADI workorder_update to check while creating production order that the Prod Version being used in the Prod Order must be assigned to Cost Obj Node... Cost Obj Nodes are stored in the table CKPE
br, Ajay M -
How to create a new object for a particular class?
Hi,
Can anybody please tell the steps for creating a new object for a particular class.
Thanks,
SreejaDeclare the object as TYPE REF TO the class and use the CREATE OBJECT statement to create an object.
DATA <obj_name> TYPE REF TO <class_name>.
CREATE OBJECT <obj_name>.
Please mark points if the solution was useful.
Regards,
Manoj -
Garbage collection of objects created inside a method
I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?
here with code
public List<StgAuditGeneral> getAudits(
List<StgAuditGeneral> audits= new ArrayList<StgAuditGeneral>();
for(Map<String, String> result :results ){
audits.add(new MapToObject<StgAuditGeneral>() {
@Override
public StgAuditGeneral getObject() {
StgAuditGeneral stg= new StgAuditGeneral();
return stg;
}.getObject());
}in the above method I cam creating tons of objects wil they be garbage collected immediatedly after jvm leaves the method ?user11138293 wrote:
I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?If there are no reachable references, to those objects, then when the method ends, they become eligible for GC. If and when they are actually collected is something we can't know or control, and generally don't care about. The only guarantee is that everything that can be collected will be collected before an OutOfMemoryError is thrown. So from our perspective, once it's eligible for collection, it is effectively collected.
If you pass references to those objects to something else that holds onto them after the method ends, then they are still reachable, and not eligible for collection.
However, you almost never need to even think about whether something is eligible for GC or not. It works pretty intuitively. -
Can I create a Class object without the VM?
Using byte-code engineering, is it possible to create a class object?
What about if I serialize a Class object to a file, can I byte-code engineer that and then reinstantiate it?Thanks I'll check it out. Basically I want to try it
for fixing a problem of running two apps in the same
VM.There's a world of problems when you try to run two programs within the same JVM. I wouldn't suggest even trying it unless it's a last resort. Why do you want to do that? -
How to create an object of our own class by using Class.forName()??
how to create an object of our own class by using Class.forName()??
plzz anser my qustion soon..Class.forName does not create an object. It returns a reference to the Class object that describes the metadata for the class in question--what methods and fields it has, etc.
To create an object--regardless of whether it's your class or some other class--you could call newInstance on the Class object returned from Class.forName, BUT only if that class has a no-arg constructor that you want to call.
Class<MyClass> clazz = Class.forName("com.mycompany.MyClass");
MyClass mine = clazz.newInstance();If you want to use a constructor that takes parameters, you'll have to use java.lang.reflect.Constructor.
Google for java reflection tutorial for more details.
BUT reflection is often abused, and often employe when not needed. Why is it that you think you need this? -
Document(object, node-set)
Using xsql 1.0.4.1, I'm having some trouble using the document(object, node-set) function defined in the XSLT 1.0 recommendation, sect 12.1:
http://www.w3.org/TR/xslt#function-document
I have a tag in my source xml document which contains a reference to another xml document. I want to construct an XPath expression for this other xml document. The path to the other xml document is specified relative to the source document.
I'm doing something like this:
Source Document:
<blah>
<some-tag redirect="answer.xml" />
</blah>XSL:
<xsl:template match="blah/some-tag">
<xsl:variable name="redir" select="document(@redirect, / )" />
<xsl:apply-templates select="$redir//somepath" />
</xsl:template>
...However, Oracle XSLT always comes back with the following error:
XSL-1013: Error in expression 'document(@redirect, / )'.I also get this error if I try
document(@redirect, document(''))which is given as an example on pg 446 of Steve's book (but not what I want, since it resolves relative to the stylesheet).
document(@redirect)works fine, but again is not what I want.
Am I doing something wrong?
BrianThis is Oracle Bug# 1722555, hopefully which will be fixed in the 9.0.1.0.0 release. Currently the two-argument version of the document() function is not recognized properly.
-
How to create a class using java script..
Hi all,
Iam new to java script and I tried out the following program but its not working..I basically created a class just like a java prog' but Iam not getting any output or error.Iam attaching the code below.
If I created one function inside the script and create one object its working fine but what should I do when I have a lot of function??so I created a class and put all the function and created an object but its not working..
Do let me know what changes should I do..Iam attaching the code which I had written. or give me an example of how to create a class with couple of functions using JAVASCRIPT
Thanks
Avis_su
<html>
<head><title>JSP Page</title></head>
<body>
<SCRIPT language = "JavaScript">
<!--
//Created classes
class book
var title: String;
var author:String;
function author()
doucument.write("Author is " +this.author);
function tile()
doucument.write("Title is " +this.title);
function printall()
var counter = 0;
function author();
function title();
var chapters = Array[String];
for(chapter in this chapters)
counter++;
document.write("Chapter" counter" :"+this.chapters[chapter]+"<br>");
var thisbook = new book()
thisbook.author = "Sivagami";
thisbook.title = "MS in CS giude";
thisbook.chapters = new Array[10];
thisbook[0] = "Prepare to Excell in all ";
thisbook[1] = "Learn to be happy";
thisbook[2] = "Learn to be healthy mentally emotionally physically";
thisbook[3] = "Siva and Subbu along with kidssssss will be successful in future";
thisbook.printall();
//-->
</script>
</body>
</html>Run this program to get your answer:
public class AnswerToYourPost {
public static void main(String args[]) {
System.out.println("TRUE/FALSE: This question
ion belongs on a Java forum.\n"
+ "ANSWER: " + ("Javascript" == "Java"));
}Since when do we compare objects for equality using operator == ? -
Error Occured While Creating message class 8II In SapNote 1486147
Dear All
I applied SapNote 1486147 but at the time of creating message class 8II
It shows error like this
Object MSAG 8II is in reserved name range for sap partner
Any body help on this.
Edited by: chandrap on Feb 24, 2011 2:08 PMHi Yasir,
remove the jaxb.jar from the WEB_INF/lib and move
them to your SUNWappserv/lib/endorsed - dir, together
with the following jars:
dom.jar jaxb-api.jar jaxb-impl.jar jaxb-libs.jar
jaxb-xjc.jar namespace.jar relaxngDatatype.jar
r xalan.jar
xercesImpl.jar xsdlib.jar
(restart the deploytool if used)
This should work,
Bas van OudenaardeHi Bas
Thank you for the very useful tip but I don't seem to have a SUNWappserv/lib/endorsed - directory inside my .war archive , could you please advise on this issue -
Dynamically create a class based on database tables
I am trying to build a database and tables on the fly, and save to the harddisk(done). Then I need to create a class using the info from the tables on the fly.
For example,
I built a database BANK, and a table Customer,
Customer
ID
Phoneno
Address
Could I create a class named CUSTOMER (table name)
dynamically, and have ID, PHONENO, ADDRESS,as the attributes of the class?
Could anyone help or show the direction?
Cheers.You could use a HashMap, and use the String keys "Customer", "ID", etc, and if you have primitive values like an int, you just wrap it inside Integer or any of the other wrapper classes, because HashMap only works with objects.
Then you can use an ArrayList to hold all the records (one record is one HashMap as described above). -
How to return Values from Oracle Object Type to Java Class Object
Hello,
i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
CREATE OR REPLACE TYPE person_type AS OBJECT
ID NUMBER,
vorname VARCHAR2(30),
nachname VARCHAR2(30),
geburtstag DATE,
CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
p_nachname VARCHAR2,
p_geburtstag DATE) RETURN SELF AS RESULT,
MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
MEMBER PROCEDURE load_object(p_id NUMBER),
MEMBER PROCEDURE save_object,
MEMBER PROCEDURE insert_object,
MEMBER PROCEDURE update_object,
MEMBER PROCEDURE delete_object
MEMBER PROCEDURE load_object(p_id NUMBER) IS
BEGIN
SELECT p.id, p.vorname, p.nachname, p.geburtstag
INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
FROM person p
WHERE p.id = p_id;
END;
My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
PersonObjectType p = new PersonObjectType();
p.load_object(4);
There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
Thanks a lot.
Edited by: NTbc on 13.07.2010 15:36
Edited by: NTbc on 13.07.2010 15:36CallableStatement =
"DECLARE
a person_type;
BEGIN
a.load_object(4);
? := a;
END;"
And register as an out parameter.
Edited by: michael76 on 14.07.2010 05:01
Maybe you are looking for
-
Report customerwisebreak up of trade receivable account
can u give list of AR tables that helps to build report on customerwisebreak up of trade receivable account
-
One of the folders on my external hard drive has transformed into a unix executable file and I can no longer access my files. Is there any way to save the data?
-
Problems editing adobe 9 pro PDF in adobe X pro
Using Outlook 2007, I created a PDF of all items that were in a folder I created. The version I was using at the time was Adobe Acrobat pro 9. In version 9, I had a field that I could populate called "Jurisdiction", which was available as a column
-
Acrobat Help | Creating and distributing PDF forms
This question was posted in response to the following article: http://helpx.adobe.com/acrobat/using/creating-distributing-pdf-forms.html
-
HI , While creating adoforms : when am activating the form it is generating an error : 'No Layout exists in original language EN'. Can anyone tell me why this message is displaying.