How to use reflection to get base classes protected field

I have one base Base classes which have protected fields and public get method to get the field.
class Base
protected int proField;
public int getProField(){return proField;}
Class Derive extends base class Base
class Derive extends Base implements OtherInterface
public void funtion(){};
Now I have an instance of Derive, how can I use reflection to get the protected field inherited from Base. It seems Java Reflection only give runtime accessibility to public field and decleared field, protected-inherited field is excluded.
Thanks
Lei

as the last poster said, traverse up the class hierarchy.
ex:
private void doSumfinToField(String fieldName throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
Class clazz = getClass();
Field field = findFieldInClass(clazz, fieldName);
//field.doSumfin;
private Field findFieldInClass(Class clazz, String fieldName) throws NoSuchFieldException {
try { // to find the field in this class    
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
// if we don't have a superclass, continue
if (clazz.getSuperclass().equals(Object.class)) {
throw e;
// check in the superclass
return findFieldInClass(clazz.getSuperclass(), fieldName);
}

Similar Messages

  • JNI: How to use FindClass to get a class in a Jar file?

    Is it possible to use the FindClass method of the JNI environment object to get a class that is in a jar file? My sample application was working when my class files were in the local directory. Now that I have replaced the class files with a jar file containing the classes, the app no longer works. I'd appreciate tips from anyone who knows how to do this.
    -Andreas

    Is it possible to use the FindClass method of the
    JNI environment object to get a class that is in a
    jar file? My sample application was working when my
    class files were in the local directory. Now that I
    have replaced the class files with a jar file
    containing the classes, the app no longer works. I'd
    appreciate tips from anyone who knows how to do this.It has nothing to do with JNI.
    The method uses the class path just like any other class loading situation in java. The reason it worked before is because your class path included the directory. It doesn't work now because either the jar is not in the class path or there is something wrong with the class path.

  • How To: Use reflection to create instance of generic type?

    I would like to be able to use reflection to instantiate an instance of a generic type, but can't seem to avoid getting type safety warnings from the compiler. (I'm using Eclipse 3.1.1) Here is a trivial example: suppose I want to create an instance of a list of strings using reflection.
    My first guess was to write the following:
    Class cls = Class.forName("java.util.ArrayList<String>");
    List<String> myList = cls.newInstance();The call to Class.forName throws a ClassNotFoundException. OK, fine, so I tried this:
    Class cls = Class.forName("java.util.ArrayList");
    List<String> myList = cls.newInstance();Now the second line generates the warning "Type safety: The expression of type List needs unchecked conversion to conform to List<String>".
    If I change the second line to
    List<String> myList = (List<String>)cls.newInstance();then I get the compiler warning "Type safety: The cast from Object to List<String> is actually checking against the erased type List".
    This is a trivial example that illustrates my problem. What I am trying to do is to persist type-safe lists to an XML file, and then read them back in from XML into type-safe lists. When reading them back in, I don't know the type of the elements in the list until run time, so I need to use reflection to create an instance of a type-safe list.
    Is this erasure business prohibiting me from doing this? Or does the reflection API provide a way for me to specify at run time the type of the elements in the list? If so, I don't see it. Is my only recourse to simply ignore the type safety warnings?

    Harald,
    I appreciate all your help on this topic. I think we are close to putting this thing to rest, but I'd like to run one more thing by you.
    I tried something similar to your suggestion:public static <T> List<T> loadFromStorage(Class<T> clazz) {
        List<T> list = new ArrayList<T>();
        for ( ...whatever ...) {
           T obj = clazz.newInstance();
           // code to load from storage ...
           list.add(obj);
        return list;
    }And everything is fine except for one small gotcha. The argument to this method is a Class<T>, and what I read from my XML storage is the fully qualified name of my class(es). As you pointed out earlier, the Class.forName("Foo") method will return a Class<?> rather than a Class<Foo>. Therefore, I am still getting a compiler warning when attempting to produce the argument to pass to the loadFromStorage method.
    I was able to get around this problem and eliminate the compiler warning, but I'm not sure I like the way I did it. All of my persistent classes extend a common base class. So, I added a static Map to my base class:class Base
       private static Map<String, Class<? extends Base>> classMap = null;
       static
          Map<String, Class<? extends Base>> map = new TreeMap<String, Class<? extends Base>>();
          classMap = Collections.synchronizedMap(map);
       public static Class<? extends Base> getClass(String name)
          return classMap.get(name);
       protected static void putClass(Class<? extends Base> cls)
          classMap.put(cls.getName(), cls);
    }And added a static initializer to each of my persistent classes:class Foo extends Base
       static
          Base.putClass(Foo.class);
    }So now my persistence code can replace Class.forName("my.package.Foo") with Base.getClass("my.package.Foo"). Since Foo.class is of type Class<Foo>, this will give me the Class<Foo> I want instead of a Class<?>.
    Basically, it works and I have no compiler warnings, but it is unfortunate that I had to come up with my own mechanism to obtain a Class<Foo> object when my starting point was the string "my.package.Foo". I think that the JDK, in order to fully support reflection with generic types, should provide a standard API for doing this. I should not have to invent my own.
    Maybe it is there and I'm just not seeing it. Do you know of another way, using reflection, to get from a string "my.package.Foo" to a Class<Foo> object?
    Thanks again for your help,
    Gary

  • How to use abap memory in global class

    Hi experts,
                     I want to  know how to use abap memory in global class. when i try write export and import statement its showing
    error is export statement does not support in object oriented concept.
    Thanks
    Ramesh Manoharan

    Hi Ramesh,
    Export and import statements were not allowed to use in  classes. Create a global variable in public section of that class of type of  export parameter.Then pass value to the global variable of class  by calling that class.
    by
    Prasad GVK.

  • V.Important: How to use se24 to build a class step by step:  Points assured

    hi all
    I am new to OO based abap programming.  I want to build a class using SE24 but i dont know where to put the various pieces of code in SE24.
    Can anyone please provide a step by step procedure (including screenshots) on how to use SE24 to build a class using most of the features like constructor, attributes , interface , friend etc.
    Documents would be more helpful as compared to links.
    Points will be awarded
    thanks in advance

    Hi,
    Just follow the below givenlink. Using this you can create a class in SE24.
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/f4b1406fecef0fe10000000a1550b0/content.htm
    I think the below document would be
    a very good introduction
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0a33479c-0b01-0010-7485-dc8c09d6bc69
    See the Following Dem Program:
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_DIALOG_BOX Splitter Control for Screen with Dialog Box
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    Regards,
    Padmam.

  • Using reflection to get method body

    Hi,
    I'm just getting into this side of program and while I understand the use of reflection in oredr to obtain the constructor and method, parameters, fields etc I was wondering if its possible to grab the method body and copy it into a string.
    So for example in the following class...
    class MyClass
    private String str;
    MyClass(){}
    public String MyMethod(String s)
    str=s;
    str=str+" was the String";
    System.out.println(str);
    return str;
    ...I need to capture just this code..
    str=s;
    str=str+" was the String";
    System.out.println(str);
    return str;
    ...as a string
    The reason i need to do this is that I'm programming a mechanism for storing objects and their methods using JDBC.. I could use object serialisation and store as a blob, but I'm wanting to store the attributes of a class as seperate parts so I can retrieve bits of code from the database at some later time.
    Thanks for any help you might give me
    peace
    neil

    You say that you are trying to store the method body
    into a database. This is to allow you to store an
    object and its methods into a database. Are you trying
    store the method text or its implementation (i.e class
    or java). If it is the implementation then just
    serialize the found method object using reflection.
    WHY are you doing this ?? what about private methods,
    class variables, class methods ???Hi, yes it is confusing to explain, but I'm experimenting with a new programming paradigm called AspectJ and I've only just got into Reflection. I'm creating a repository of Aspects (same as classes but with added functionality and some limitations) with JDBC and don't want to just serialise the object as a blob and so have created data tables to hold different parts of the anatomy of an Aspect and this was the only thing I was getting stuck on.
    The idea is that the user is able to recall these whole aspects (or a part of them such as a method) on the fly and use them in a program. I realise that ther will be problems because these methods may have other dependencies such as the ones you explain above but its just experimental at the moment and those are the kinds of things I'm wanting to find out more.
    I've seen examples of reflection for Objects but never for methods. So it is possible to capture just a method by serialisation using reflection? Any examples would be much appreciated.
    Peace
    Neil

  • Problems using different tables for base class and derived class

    I have a class named SuperProject and another class Project derived from
    it. If I let SchemaTool generate the tables without specifying a "table"
    extension, I get a single TABLE with all the columns from both classes and
    everything works fine. But if I specify a "table" for the derived class,
    SchemaTool generates the derived class with just one column (corresponds
    to the attribute in derived class). Also it causes problems in using the
    Project class in collection attributes.
    JDO file:
    <jdo>
    <package name="jdo">
    <class name="Project" identity-type="application"
    persistence-capable-superclass="SuperProject">
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    </class>
    <class name="SuperProject" identity-type="application"
    objectid-class="ProjectId">
    <field name="id" primary-key="true"/>
    </class>
    </package>
    </jdo>
    java classes:
    public class Project extends SuperProject
    String projectSpecific
    public class SuperProject
    BigDecimal id;
    String name;
    tables generated by SchemaTool:
    TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
    TABLE PROJECT(PROJECTSPECIFICX)
    Thanks,
    Justine Thomas

    Justine,
    This will be resolved in 2.3.4, to be released later this evening.
    -Patrick
    In article <aofo2q$mih$[email protected]>, Justine Thomas wrote:
    I have a class named SuperProject and another class Project derived from
    it. If I let SchemaTool generate the tables without specifying a "table"
    extension, I get a single TABLE with all the columns from both classes and
    everything works fine. But if I specify a "table" for the derived class,
    SchemaTool generates the derived class with just one column (corresponds
    to the attribute in derived class). Also it causes problems in using the
    Project class in collection attributes.
    JDO file:
    <jdo>
    <package name="jdo">
    <class name="Project" identity-type="application"
    persistence-capable-superclass="SuperProject">
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    </class>
    <class name="SuperProject" identity-type="application"
    objectid-class="ProjectId">
    <field name="id" primary-key="true"/>
    </class>
    </package>
    </jdo>
    java classes:
    public class Project extends SuperProject
    String projectSpecific
    public class SuperProject
    BigDecimal id;
    String name;
    tables generated by SchemaTool:
    TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
    TABLE PROJECT(PROJECTSPECIFICX)
    Thanks,
    Justine Thomas
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • How to use custom password encryptor/decryptor class for jdbc connection

    I am in process of migrating application from Jrun server to weblogic . In jrun we use to provide our custom class which used to decrypt the password provided in resource file as below
    <username>webclt</username>
    <password>AAAAAAASSSSSSSCCCCCCCCCCCCCC</password>
    <encrypted>true</encrypted>
    <encryption-class>com.CustomEncryptor</encryption-class>
    How could i use the same class while configuring datasource in weblogic 10 server.

    1- By default, the jre will read the user's cacerts which runs the program.
    2- You can specify another cacerts this way :
    System.setProperty("javax.net.ssl.trustStore", my_trust);
    For the case 1 and 2, you need to put the certificate in the cacerts.. Or,
    3- You implement a custom TrustManager which, for example, accepts all certificates :
    class X509TrustManagerTrustAll implements X509TrustManager {
    public boolean checkClientTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public boolean isServerTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public boolean isClientTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
    return null;
    public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {}
    public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {}
    and you call it in the right place in the code you wrote (SSLContext,..)
    Hope it helps and deserves a duke star ;)

  • How to use logging in the actions classes extends standart actions?

    Hello!
    I have some action classes extends standart actions, for example Z_ExtMaintainBasketDispatcherAction extends MaintainBasketDispatcherAction. I tried to use logging functionality in my classes but there were no my lines in log and trace files.
    For example I added followed lines in basketPerform() method of Z_ExtMaintainBasketDispatcherAction:
    boolean isDebugEnabled = log.isDebugEnabled();
    if(isDebugEnabled){
    log.debug("++++++++++++++++ Test tracing in B2B_SNG. ++++++++++++++++");
    but in there was no such line neither in log file nor in trace file.
    How I can use logging functionality in my own classes? I need it for tracing and logging.
    CRM 5.0
    regards, Lev

    Well, here is solution. I created a log formatter and log destination like this:
    <log-formatters>
    <log-formatter name="application_sap.com/crm~b2b" type="TraceFormatter" pattern="%d,%-3p %t %s %l %m"/>
    </log-formatters>
    <log-destinations>
    <log-destination name="application_sap.com_crm.b2b" type="FileLog"
        count="10" effective-severity="ALL" limit="10000000" pattern=".\log\applications\isa_ru.log">
    <formatter-ref name="application_sap.com/crm~b2b"/>
    </log-destination>
    </log-destinations>
    and new log controller like this:
    <log-controller effective-severity="ALL" name="ru.sng.isa">
    <associated-destinations>
    <destination-ref name="application_sap.com_crm.b2b" association-type="LOG"/>
    </associated-destinations>
    </log-controller>
    in file META-INF\log-configuration.xml
    Thanks everybody for help!
    Regards, Lev.

  • How to use PDPageEnumContents to get PDText?

    Please help me to use PDPageEnumContents to get PDText, the callback and PDGraphic confused me. I donnot know how to write. I am a green hand in Plugin Development.
    Thank you.
    Jason Wang

    This is an obsolete method. It should no longer be used.
    Aandi Inston

  • How to use  SET and GET parameter commands ?

    Explain these two giving an example?As which is used for what?

    Hi Albert,
             SAP allows you to make use of SPA/GPA technique to fill the input fields of a called transaction with data from the calling program.SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
    When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
    When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
    However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
    If you want to set SPA/GPA parameters before a program call, you need to know which parameters are linked to which fields on the initial screen. A simple way of doing this is to start the program that you want to call, place the cursor on the input fields, and choose F1 followed by Technical info. The Parameter ID field contains the name of the corresponding SPA/GPA parameter. Alternatively, you can look at the screen definition in the Screen Painter.
    The SPA/GPA parameter for the input field Company has the ID CAR. Use this method to find the IDs CON, DAY, and BOK for the other input fields.
    The following executable program is connected to the logical database F1S and calls an update transaction:
    REPORT BOOKINGS NO STANDARD PAGE HEADING.
    TABLES SBOOK.
    START-OF-SELECTION.
      WRITE: 'Select a booking',
      SKIP.
    GET SBOOK.
      WRITE: SBOOK-CARRID, SBOOK-CONNID,
             SBOOK-FLDATE, SBOOK-BOOKID.
      HIDE:  SBOOK-CARRID, SBOOK-CONNID,
             SBOOK-FLDATE, SBOOK-BOOKID.
    AT LINE-SELECTION.
      SET PARAMETER ID: 'CAR' FIELD SBOOK-CARRID,
                        'CON' FIELD SBOOK-CONNID,
                        'DAY' FIELD SBOOK-FLDATE,
                        'BOK' FIELD SBOOK-BOOKID.
      CALL TRANSACTION 'BOOK'.
    The basic list of the program shows fields from the database table SBOOK according to the user entries on the selection screen. These data are also stored in the HIDE areas of each line.
    Cheers
    Nishanth

  • How to use ADD_METADEF to add a custom metadata field

    Hi All,
    I am trying to add a custom metadata field to check in profile, and this I want to do using RIDC library through my java program. I have tried the following code, but some how I could not see its getting added to Information Fields and also to Standard check in profile.
    Can you let me know what am I missing?
                myIdcClient = myIdcClientManager.createClient("idc://XXXX:4444"); // just commented out
                IdcContext myIdcContext = new IdcContext("weblogic", "weblogic1");
                ServiceResponse myServiceResponse = null;
                  DataBinder myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "UPDATE_OPTION_LIST");
                    myRequestDataBinder.putLocal("dKey", "xLocationList123");
                  myRequestDataBinder.putLocal("OptionListString", "Madrid\nTokyo\nLondon\nWashington");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "ADD_METADEF");
                    myRequestDataBinder.putLocal("dName", "xLocations123123");
                    myRequestDataBinder.putLocal("dIsRequired", "0");
                    myRequestDataBinder.putLocal("dOptionListKey", "xLocationList123");
                    myRequestDataBinder.putLocal("dOptionListType", "choice");
                    myRequestDataBinder.putLocal("dIsOptionList", "1");                    
                    myRequestDataBinder.putLocal("dIsSearchable", "1");
                    myRequestDataBinder.putLocal("dIsEnabled", "1");
                    myRequestDataBinder.putLocal("dType", "Text");
                    myRequestDataBinder.putLocal("FieldName", "xLocations123123");
                    myRequestDataBinder.putLocal("dCaption", "Locations");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    //IdcService=UPDATE_META_TABLE
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "UPDATE_META_TABLE");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "START_SEARCH_INDEX");
                    myRequestDataBinder.putLocal("IsRebuild", "1");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
                    myRequestDataBinder = myIdcClient.createBinder();
                    myRequestDataBinder.putLocal("IdcService", "PUBLISH_SCHEMA");
                    myServiceResponse = myIdcClient.sendRequest(myIdcContext, myRequestDataBinder);
    Thanks in advance.

    Try calling the following code:
    import static intradoc.shared.MetaFieldUtils.hasDocMetaDef;
    import static intradoc.shared.MetaFieldUtils.updateMetaDataFromProps;
    import intradoc.common.ServiceException;
    import intradoc.data.DataBinder;
    import intradoc.data.DataException;
    import intradoc.data.Workspace;
        protected static void addMetadataFields(final Workspace workspace, final DataBinder binder) {
            traceVerbose("Start addMetadataFields");
            // Parameters for metadata field
            final String[] parameters = new String[] { "dsdComponentName", "dComponentName", "dsdVersion", "dType", "dIsRequired", "dIsEnabled", "dIsSearchable", "dIsOptionList", "dOptionListKey", "dOptionListType", "dDefaultValue", "dOrder", "dIsPlaceholderField", "dsdCheckFlag",
                    "dsdDisableOnUninstall" };
            // Common values for primary and alternate field values
            final String[] values = new String[] { "ComponentName", ComponentName, "build_1_20131206", "BigText", "0", "1", "1", "0", "", "", "", "2500", "0", "", "" };
            // Primary file checksum field parameters and values
            final Properties field = new Properties();
            for (int i = 0; i < parameters.length; i++) {
                field.put(parameters[i], values[i]);
            // Setup primary file specific parameters
            field.put("dName", "Metadata field name");
            field.put("dCaption", "Metadata field caption");
            try {
                // Name of metadata field
                final String fieldName = field.getProperty("dName");
                trace("dName: " + fieldName);
                if (fieldName != null && fieldName.length() > 0 && !hasDocMetaDef(fieldName)) {
                    try {
                        updateMetaDataFromProps(workspace, null, field, fieldName, true);
                        trace("Successfully added metadata field " + fieldName);
                    } catch (final ServiceException e) {
                        warn("Metadata field " + fieldName + " was not installed.", e);
                    } catch (final DataException e) {
                        warn("Metadata field " + fieldName + " was not installed.", e);
                } else {
                    trace("Metadata field already exists; will not modify");
            } finally {
                traceVerbose("End addMetadataFields");
    Jonathan
    http://jonathanhult.com

  • How to recognize the name of invoked classes&methods&fields in a class

    I am now doing some programming used to recognize the name of all classes, methods, constructors and fields invoked from other classes in a given class. This recognition is required automatical. Now I really have no idea how to realize it. Can anyone please give me some suggestions how to programme it?
    Now I show you a specific example to make sure you understand my question.
    From the following example, firstly I've no idea what outer classes, methods and fields are used in class "PointShadowProtocol". However, the expected functionality of realization is to find out: 1, the name of two used outer classes: Shadow, Point; 2, invoked constructor: Shadow s=new Shadow(int x,int y); 3, invoked methods: Point.getX()&#65292; Point.getY()&#65292; Point.printPosition()&#65292;Shadow.offset&#65292;Shadow.printPosition(); and 4, invoked field: Point.x,Point.y,Shadow.x,Shadow.y
    public class PointShadowProtocol{
    private int shadowCount=0;
    public static Shadow getShadow(Point p){
    Shadow s=new Shadow(p.x,p.y);
    return s;
    public void setting(Point p){
    Shadow s=new Shadow(p.x,p.y);
    shadowCount++;
    public void settingX(Point p){
    Shadow s=getShadow(p);
    s.x=p.getX()+Shadow.offset;
    p.printPosition();
    s.printPosition();
    public void settingY(Point p){
    Shadow s=getShadow(p);
    s.y=p.getY()+Shadow.offset;
    p.printPosition();
    s.printPosition();
    Actually, after realizing this functionality, I will use these results to automatically generate the related class stub, method stub, field stub, which can be used to test the given class "PointShadowProtocol", probably equivalent to unit test.
    Any suggestions are welcome. Thank you in advance for your reply.

    Using BCEL sounds a good idea for a class in Java. Actually, I want to target an aspect, which is from AspectJ, without knowing any invoked classes, class methods and fields inside an aspect in the first place (examples of an aspect is as showed below). An aspect in AspectJ is just like a class in Java. But an aspect can't be compiled if the invoked outer classes and methods don't exist. (In fact, the weaving of an aspect into classes happens in the compile time, an aspect can't be compiled if the woven classes (or invoked classes) don't exist, which means I have to find out the all the invoked classes, class methods and fields in that aspect before the compile time) So BCEL could not apply into an aspect in AspectJ.
    I am sorry to introduce new concepts here. However,the solution to find out all the invoked outer classes, class methods and fields in a given class before the compile time can be applied to an aspect as well.
    Thank you for your time to think about my question.
    public aspect PointShadowProtocolAspect {
         private int shadowCount=0;
         public static Shadow getShadow(Point p){
              Shadow s=new Shadow(p.x,p.y);
              return s;
         pointcut setting(Point p): target(p)&&call(Point.new(int,int));
         pointcut settingX(Point p):target(p)&&call(void Point.setX(int));
         pointcut settingY(Point p):target(p)&&call(void Point.setY(int));
         after(Point p): setting(p){
              Shadow s=new Shadow(p.x,p.y);
              shadowCount++;
         after(Point p):settingX(p){
              Shadow s=getShadow(p);
              s.x=p.getX()+Shadow.offset;
              p.printPosition();
              s.printPosition();
         after(Point p):settingY(p){
              Shadow s=getShadow(p);
              s.y=p.getY()+Shadow.offset;
              p.printPosition();
              s.printPosition();

  • How to use the separate symbol in the text field in the adobe form.

    Hi,experts,
    I don’t know how to use the separate symbol to make a paragraph separate into several lines correctly in the text field in the adobe form.
    Action:
    1. config the ADS successfully.
    2. create the adobe form with a mult-line textfield(binding the 'remark' context in the interface of the form) using sfp.
    3. create a WDA for invoke the form and transfer the 'remark' context data.
    I use the following codes to display the paragraph in the PDF document:
    CONCATENATE
    '1&#12289;aaaaaaaaaaa&#65307;'
    '2&#12289;bbbbbbbbb '
    '3&#12289;ccccccccccc'
    '4&#12289;ddddddddd'
    INTO remark .
    lo_nd_z_hr_php_payslip->set_attribute(
    EXPORTING
    name = `REMARK`
    value = remark ).
    But I found all the content aren't paragraph separate correctly in the text field in the adobe form when I run the WDA.
    Could you please give me some hints to make the paragraph separate correctly in PDF document? Thanks a lot in advance!
    My email is : [email protected]
    Best regards,
    Tao
    Edited by: wang tao on Apr 8, 2008 1:58 AM

    Hi,
    If it is just a one word value then you could use this in the exist event;
    this.rawValue    
    = util.printx(">?<*",this.rawValue);
    This changes the first character (represented by the ?) to uppercase (represented by the >) and all trailing characters (represented by the *) to lowercase (represented by the <).
    If you wanted something more general ... if they could also enter a middle name then you could call a function like;
    function        toTitleCase(textValue)
      return  textValue.toLowerCase().replace(/\b[a-z]/g, function replacer(match) { return match.toUpperCase(); });
    This uses a regex to change all lowercase letters following a word boundary to uppercase.
    Bruce

  • Anoyone know how to use Reflection?

    I'd like to export certain properties from an ai-document to XML. The XML will be post-processed using XSLT. Secretly, I'm hoping that I can invoke the Reflection-system (as mentioned brifely, I might add) in the ExtendedScript Toolkit CS6 Core JavaScript Classes.
    Do anyone know how to get reflection working for JavaScript objects (both built-in and the ones I've created in code my self)? Are there any guides that are relevant in my case? (Try googling "illustrator script reflection" and you get a bunch of flip object scripts ...)

    Found it. Had to alter my google query ... (Try "extendscript reflection", and you'll see what I mean.)
    For reference, try the following:
    var xmlSource = myCustomObject.reflect.toXML();
    alert ( xmlSource );

Maybe you are looking for