Class Reference?

I can't figure out how to create a reference to a class so I don't have to keep typing the class.staticvar.item
So usually I have this:
DocClass.build_class.firstFunction();
I would rather in my sub class just be able to say;
private var build_class:Class = Class(getDefinitionByName("DocClass.build_class"));
so throughout the sub class I only have to type the reference, build_class...
What am I doing wrong?

Still can't get it. In a sub class if I try to reference the parent class by doing this
private var build_stage_class:BuildStageClass = BuildStageClass;   // errror
private var build_stage_class:BuildStageClass = DocClass.build_stage_class;   // errror
private var build_stage_class:Class= DocClass.build_stage_class;   // errror
private var build_stage_class:Class=BuildStageClass;   // errror
The DocClass starts the BuildStageClass and has a static var called build_stage_class;
DocClass loads BuildStageClass
BuildStageClass loads NavClass
Nav Class trying to reference the BuildStageClass so I can reference the parent class. Obviously this doesn't save any typing however there are sub classes of the sub class which will save typing with a reference.

Similar Messages

  • How to use application class reference in the controller methods of BSP

    Hi,
    I have created a bsp application and also created an application class and assigned it to the application class. In the application class, I have created attribute TEXT type string(public and instance parameter).
    In the controller let's say main.do, I am trying to give a value to to the text by adding the following code.
    application->text = 'test'.
    I am getting syntax error saying field 'text' is unknown. It is not contained in one of the specified tables nor defined by DATA statement. 
    Please can someone let me know how to use the application class in the coding with an example. I couldn't find how exactly this has to be reference. Please help.
    Best regards
    Siva

    Hi,
    if you are having main controller and sub-controller then you may need to use below coding to use application class reference.
    *Data declaration
      DATA:  obj_cntrl        TYPE REF TO cl_bsp_controller2,
             obj_sub_cntrl   TYPE REF TO z_cl_sub_cntl,
             application TYPE REF TO z_cl_application.
    *Get the controller
      CALL METHOD obj_main_cntrl->get_controller   "obj_main_cntrl is the object of main controller
        EXPORTING
          controller_id       = 'SUB'   "Controller ID
        RECEIVING
          controller_instance = obj_cntrl  .
      obj_sub_cntrl ?= obj_cntrl  .
      application ?= obj_sub_cntrl ->application.
    or simply use below code in your controller method.
      application ?= me->application.
    Thnaks,
    Chandra

  • Link between classes: Reference Error

    Hi,
    I am still trying to create a movie clip array to make a list of objects appear on stage and have the user interact with them.
    This will be my game loop class called "LetterArray()".
    My main class is called "BugGoopFSGame()".
    After I add the line of code below into my LetterArray(). as class file I get the error message below:
    Code entered:
    private var  lettersL1:Array = new Array[a,f,g,h,i,n,o,s,t];
    This is the error message I get:
    ReferenceError: Error #1069: Property [object T] not found on S and there is no default value.
        at LetterArray()
        at BugGoopFSGame()
    I am sure the reference I use between the two files are not good. Can you please tell me what code I should add and where.
    Thanks for your help!
    Charine
    This is the code in my main class - BugGoopFSGame()
    package
        import flash.display.*;
        import flash.utils.Timer;
        import flash.events.*;
        import flash.events.MouseEvent;
        import flash.media.Sound;
        import flash.events.Event;
        import flash.media.SoundChannel;
        import flash.media.SoundMixer;
        import flash.media.SoundTransform;
        import flash.text.*;
        import flash.net.URLRequest;
        public class BugGoopFSGame extends MovieClip
            public var mybackground:BackGround;
            public var letterArray:LetterArray = new LetterArray(stage); //this is how I link from main to gameloop
    This is the coce in my gameloop class - LetterArray()
    package
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.utils.Timer;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.net.URLRequest;
        public class LetterArray extends MovieClip
            private var _stage:Stage; //this reference works well to the main file. Should I somehow link it to the errorous code below?
            /*Movie clips that need to go into an array    */
            //level 1
            public var a:A = new A();
            public var f:F = new F();
            public var g:G = new G();
            public var h:H = new H();
            public var i:I = new I();
            public var n:N = new N();
            public var o:O = new O();
            public var s:S = new S();
            public var t:T = new T();
            private var letterArray:Array;
            private var  lettersL1:Array = new Array[a,f,g,h,i,n,o,s,t]; //this is the line that causes the error. I am sure it is because I need to add something to the main class.

    if, for example, A is a class name, you should use "A" and then use getDefinitionByName() to retrieve the class reference from the string.
    private var  lettersL1:Array = new Array['A','F','G','H','I','N','O','S','T'];
    for(var i:int=0;i<lettersL1.length;i++){
    var C:Class=Class(getDefinitionByName(lettersL1[i]));  // import flash.utils.getDefinitionByName
    var c:*=new C(); // create instances from the classes in lettersL1
    // do whatever with c
    or, move those instanciation statements into your LetterArray constructor or somewhere beyond like:
    package
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.utils.Timer;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.net.URLRequest;
        public class LetterArray extends MovieClip
            private var _stage:Stage; //this reference works well to the main file. Should I somehow link it to the errorous code below?
            private var letterArray:Array;
            private var  lettersL1:Array; //this is the line that causes the error. I am sure it is because I need to add something to the main class.
            public function LetterArray(ss:Stage):void{
                var a:A = new A();
                var f:F = new F();
                 etc
                lettersL1 = [a,f,...]
                _stage = ss;

  • How can i use class reference from an array effeciently?

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

  • ABAP Class reference in persistent container

    Hi all,
    Has anyone ever tried to read an abap class reference from a rule container in the rule's function module?
    This doesn't seem to work, unless I am doing something wrong...
    Here is the scenario:
    I have an abap class ZCL_CLASS instantiated in my workflow container. In one of my workflow steps I pass that class object reference to a rule (Function Module based). In the rule function module I use macro swc_get_element to try to get the class object reference. And there it is not getting anything.
    I have already tried the following:
    - Try to run macro swc_container_to_runtime on the rule container before retrieving the object reference -> doesn't work. The internal table ac_container doesn't even look different before and after having run this macro.
    - Try to replace the declaration of include <CNTN01> by <CNTN02> + <CNTN03>. Doesn't change anything either.
    When I look at ac_container in debugging it seems my object reference is there but looks a bit strange:
    ELEMENT | TAB_INDEX | ELEMLENGTH | TYPE | VALUE
    WFIBF_PORTAB | 000011 | 004 | u | SWFTSTRUCT
    WFIBF_PORTAB | 000012 | 032 | C | STEP
    WFIBF_PORTAB | 000014 | 032 | C | 1CCC1000C
    WFIBF_PORTAB | 000015 | 104 | C | <object key>    <class>    CL
    Any idea of how I should proceed to retrieve my object reference?
    For the moment the workaround I found is to pass the object key to the rule and to reinstantiate the class in the rule function module. Not a very elegant solution...
    Thanks in advance and kind regards,
    Patrick

    Hi Mike,
    I understand what you're saying. But the problem is that the swc_get_element macro does not even get me the LPOR value, and therefore I can't call the FIND_BY_LPOR method.
    That means I have two solutions:
    - Passing the LPOR instead of the object reference to the rule container => Not a very nice solution, for many different reasons.
    - Find an alternative to swc_get_element to get the LPOR value.
    I had a look at class cl_swf_cnt_container, and it seems it can do the trick for me.
    So what I will finally do is:
    1. Convert the BOR container into an instance of cl_swf_cnt_container.
      DATA: lo_cnt    TYPE REF TO if_swf_cnt_container,
                 lt_container TYPE swconttab.
      lt_container[] = ac_container[].
      TRY.
          CALL METHOD cl_swf_cnt_container=>if_swf_cnt_conversion~create_from_bor_container
            EXPORTING
              values                = lt_container
            RECEIVING
              container           = lo_cnt.
        CATCH cx_swf_utl_obj_create_failed.
      ENDTRY.
    2. Get my container element.
    DATA: lo_myobj TYPE REF TO zcl_class.
    CALL METHOD lo_cnt->if_swf_ifs_parameter_container~get
      EXPORTING
        name       = 'MyContainerElement'
      IMPORTING
        value      = lo_myobj
    I didn't take the time to debug that deep in the standard SAP code, but I assume the if_swf_ifs_parameter_container~get re-instantiates my class for me.
    Please feel free to comment.
    Kind regards,
    Patrick

  • Class reference internal table

    Hello Gurus,
    i have an internal table filled with class references and i need to acces the one field of a structure of every class.
    I am now trying something like this:
    loop ref_table assigning <l_wrk_ref_but0id>.
          IF <l_wrk_ref_but0id>->m_str_but0id-type = /gkv/cd40_cl_const=>con_pkkv.
          ENDIF.
    endloop.
    I need the field "type" in the structure "m_str_but0id" of every class (reference) in the table. The error that i'm getting is: "Field m_str_but0id unknown".
    Please help.
    Ioan Constantin.

    Hello Ioan
    You have to access the field dynamically as well:
    DATA:
       ld_structure  TYPE <name of structure>,
       ld_attribute    TYPE tabname,
       ld_field          TYPE fieldname.
    FIELD-SYMBOLS:
      <ls_struct>     TYPE any,
      <ld_fld>           TYPE any.
    ld_attribute = 'M_STR_BUT0ID'.
    ld_field       = 'TYPE'. 
    loop ref_table assigning <l_wrk_ref_but0id>.
         ASSIGN <l_wrk_ref>but0id>->(ld_attribute) TO <ls_struct>.
         ASSIGN COMPONENT (ld_field) OF STRUCTURE <ls_struct> TO <ld_fld>.
    "      IF <l_wrk_ref_but0id>->m_str_but0id-type = /gkv/cd40_cl_const=>con_pkkv.
           IF ( <ld_fld> = /gkv/cd40_cl_const=>con_pkkv ).
          ENDIF.
    endloop.
    Even simpler might be the following approach:
    LOOP AT ref_table assigning <l_wrk_ref_but0id>
                    WHERE ( table_line->m_str_but0id-type = /gkv/cd40_cl_const=>con_pkkv ).
    ENDLOOP.
    " Assumption: Itab has class reference type as line type.
    Regards
      Uwe

  • WMI Class Reference for Dynamics CRM Performance Counters

    Hello,
    I am trying to monitor a MS Dynamics CRM 2013 instance using the
    Performance Counters provided. 
    I will be writing VB Script to collect the performance counter data via WMI. 
    I couldn't find out the WMI class reference the Dynamics CRM 2013 performance counters.  
    What I meant was, some thing similar to the 'Windows Server Cluster' Object and Performance counter class, as given below.
    https://msdn.microsoft.com/en-us/library/aa965285%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
    Help me on this.
    Regards,
    Krishna.

    Hi David,
    Sorry for posting in the wrong forum. Will correct it in future.
    I can't use the Perfmon as I have a java application which will call the VB Script periodically to collect the data. I need to write both VB Script and Powershell scripts. I need to have the class reference to understand the data type of each attribute in
    a performance counter. For ex,
    The 'CRMAuthentication' counter has the following attributes. 
    Caption
    ClaimsAuthenticationAttemptsInTheLastMinute
    ClaimsAuthenticationFailuresInTheLastMinute
    Description
    It is necessary to understand the datatype each attributes in the all Performance Counters. 
    Regards,
    Krishna.

  • Question on Assigning Sub Class References

    Hi Friends,
    I have small doubt regarding Assigning Class Reference to Super Class or Interface.
    List list= new ArrayList(); or Collection collection = new ArrayList();
    Map map=new HashMap();
    if i assing like above i may loose some of the specilized methods of ArrayList,Map etc...
    but most of the people are creating the objects in above fashion.
    can any body list out the advantages.
    Thanks in Advance!

    Agreed, you do lose some of the specialised methods.
    But sometimes its functionality you don't need.
    If your function takes a "Collection" it doesn't matter if its ArrayList or Set - you're just interested in the Collection Interface (common use case would be to obtain an Iterator to the underlying datastructure)
    Writing to the interface means that you can change the implementation at will.
    You can swap an ArrayList for a LinkedList. A HashMap for an LinkedHashMap or TreeMap. And the rest of your code is untouched, because it presumed nothing about the implementation.

  • I need a mechanism to expose action script class reference to java script

    I need a mechanism to expose action script class reference to java script

    Adobe, I think, are quite happy leaving the StageWebView as a highly efficient and low-level component accessing native functionality, so I wouldn't hold my breath on them extending it.
    That said, I believe somebody did implement an ANE that gives much more access and, according to the docs, does allow Javascript access.
    See UIWebView as per this thread; http://forums.adobe.com/message/4832821#4832821
    http://darkredz.com/ios-uiwebview-and-videoplayer-native-extension-for-air-mobile/
    G

  • Account class reference

    what do u mean  by account class reference and is that as same as how is that differ from account category reference?

    what do u mean  by account class reference and is that as same as how is that differ from account category reference?
    There is nothing in SAP called account class reference , There is a term called Account class which is used for creating Account groups, Account category reference is used for assignment of valuation class to Material type for pulling & assignment of G/L accounts

  • Static class reference

    Below we have a class containing a static class variable and a static accessor method.
    The method is responsible for assigning the variable, which it does on demand.
    public class MyClass
        private static int INFO = -1;
        public static int getInfo()
            if(INFO < 0)
                try
                    INFO = ...;
                catch(Exception e)
            return INFO;
        }When using this class is it not safe to assume that the assignment of the variable will ever only occur once for the life of the system that uses this class? (afterall is it static within the class)
    I am experiencing the situation whereby EVERY time the method is called, the assignment of the variable is necessary. I can only assume that the static instance of this class in memory has been lost between each call and therefore the state/value of the variable has also been lost.
    It is worth noting that no object instances of this class are ever created. The class is accessed only through its static interface. It seems that since no local reference to objects of this class are held in memory then the entire class, along with its internal static state, is cleared from memory (garbage collected?).
    How is it possible to ensure that the state of static fields within such a class is preserved over time, without create instances of the class.
    John

    When using this class is it not safe to assume that
    the assignment of the variable will ever only occur
    once for the life of the system that uses this class?First of all, you haven't said what you assign it to, so we can't say. If you assign a value less than zero then it will be reassigned next time the method is called.
    Secondly, it depends on whether or not you're expecting it to be thread-safe? It isn't.
    If your code is not multi-threaded, then the section of code in your getInfo method that assigns the field should only execute once during a single run of an application.
    Thirdly, you explicitly assign it (to minus one) at class initialisation time, so stricty speaking, the variale will always be assigned at least once, and will be assigned at least once more if the getInfo method is ever called.
    I am experiencing the situation whereby EVERY time the
    method is called, the assignment of the variable is
    necessary. Can you offer any evidence to this? A small, complete, compilable and executable example that demonstrates the problem will help, and will probably get you an answer pretty quickly around here.
    I can only assume that the static instance
    of this class in memory has been lost between each
    call and therefore the state/value of the variable has
    also been lost.Then either there is a bug in your JVM, or at least two versions of the class have been loaded, and at least one of those was not loaded by the system classloader. Without further info, we aren't going to be able to help much more here.
    The class is accessed only
    through its static interface. It seems that since no
    local reference to objects of this class are held in
    memory then the entire class, along with its internal
    static state, is cleared from memory (garbage
    collected?).This is not allowed under the JLS if the class was loaded by the system classloader. If it was loaded by another classloader, then it is only allowed if it can be determined that the class will never again be used throughout the entire run of the application. Since you are referencing the class again, this should not be happening.
    How is it possible to ensure that the state of static
    fields within such a class is preserved over time,
    without create instances of the class.From what you have told us so far, it should be. You will probably have to provide some code for us to help you further.

  • Why a sub class reference cannot hold a super class object

    class a
    class b extends a
    public static void main(String args[])
    b o1=new a();
    I know this code wont compile but i need explanation on why subclass reference cannot hold superclass object

    In short, because the subclass reference might be expected to point to an object with methods or members that the superclass object does not have.

  • Document Class reference

    This might be tough for me to explain but here it goes:
    I have a textField in Frame 1 of a swf. that swf has a
    document class. When I compile that swf i can change the text in
    the textField easily with textField.appendText(text);
    However, when I compile a second swf which references that
    document class that textField gives me an error on compile because
    it does not exist in the document class of the swf it is referring
    to. How do I solve that? When I compile I get an 1120:Access Denied
    undefined property error. If I try to define the textField in my
    document class like private var textField; I get a confilct with
    namespace internal ....
    SWF 2 has no idea SWF 1 has no idea SWF 1 has a textField in
    its timeline when it is compiling.
    Is there a way around this or do I have to create the
    textField in my document class? There has to be a way to mix
    sprites in a timeline and sprites in the document class.

    You need to do two things to get it to compile.
    1. In Publish Settings -> ActionScript Settings UNCHECK
    the Automatically declare stage instances box.
    2. Declare your text field as public: public var
    textField:TextField;

  • How to resolve class reference in java?please join in!!

    Hello all!
    In delphi ,there is a statment of reference of class,like "class of TSomeClass,I have some code write in delphi expediently,but in java hardly,please give some suggestion.here are my codes in obj.pas writed in delphi:
    TObjClass = class of TObj;
    TObj = class(TObject); //TObj is a base class..
    class procedure TObj.basemethod(..)
    begin
    end;
    TApp=class(TObj);//TApp inherted from TObj;
    class procedure TApp.basemethod(...)//override the method in TObj
    begin
    end;
    TProp=class(TObj);//TProp inherted from TObj too..;
    class procedure TProp.basemethod(...) //override the method in TObj
    begin
    end;
    TObjlist=class(TObjectlist); //anther third class
    private Itemclass:TObjclass;
    constructor TObjlist.Create(AClass : TObjclass);
    begin
    Itemclass:=AClass;
    end;
    public TObjlist.somemethod();
    begin
    Itemclass.create; //hardly writed in java;
    itemclass.basemethod(); ////hardly writed in java to invoke class method;
    end;

    You need to study the javadocs for java.lang.Class and for java.reflect.*;
    Each class in a program has an associated Class object which you can get from the classname as MyClass.class or from an object as myObject.getClass()
    From the class object you can create a new instance, or you can get a Method or Constructor object from the class and invoke that.

  • SPACES custom skin CSS Class reference ? which css styles do what?

    I am creating a custom skin for spaces using the Extend Spaces custom project. I am not able to find which css class names are mapped to which elements of a page in spaces. Inspecting the code does not help since the css class names seem to be autogenerated names and don't really match any names in the example "myskin" or any others I have seen.
    Does anyone know of a reference that shows which classes correspond to which elements in spaces?

    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html
    This is an overview of the selectors used in ADF. I think webcenter spaces only uses these. You should be able to skin your webspace using these selectors.

  • Destination Service API - missing indirect class reference

    I'm trying to use the destination service api as described in the <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm">documentation</a>, but Eclipse can't compile the code due to an indirectly referenced class called com.sap.security.core.server.util0.IDEException.
    References to com.sap.exception, security.class and tc/sec/destination/interface have already been set. According to the documentation, there should also be a reference to tc/sec/destination/service, but I don't have such an option in the context menu "Add Additional Libraries".
    So, where do I find the missing IDEException?
    Best regards,
    Frank

    The class com.sap.security.core.server.util0.IDEException is in library com.sap.exception. That's correct. Don't worry about that.
    You have to add those 3 additional libraries to your EJB Project with the right-click over project option:
    security.class
    tc/sec/destination/interface
    com.sap.exception.
    You have to add 4 references in your application-j2ee-engine.xml: : 3 to those 3 libraries and another one to the service, which doesn't appear in the popup list. Type it manually. The correct name is "tcsecdestination~service" (not /), and reference target type is "service".
    If this doesn't work, you can add to the 'java build path' of your EJB Project the libraries:
    tc_sec_destinations_interface.jar
    tc_sec_destinations_service.jar
    ... you can find them into the path of your server:
    /usr/sap/<SID>/JC00/j2ee/cluster/server0/bin/interfaces
    /usr/sap/<SID>/JC00/j2ee/cluster/server0/bin/service
    (some people has had problem with correct versions)
    If you are using DCs, you have to add those 3 libraries as Used DCs in your EJB Project. And set the 4 references in application-j2ee-engine.xml
    Hope this helps you. Don't forget the reward points
    Best regards.

Maybe you are looking for