Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4034978

reflected fields and "transient" modifier

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 1.1
    • core-libs



      Name: mc57594 Date: 02/26/97


      1. I am working with the reflection API trying to generate a generic text
      editing capability for an object database (POET). All fields will be marked either private or protected. Additionally, certain fields (which should NOT end up in the database) will be marked transient.

      Each class will implement a public get<field> and a set<field> method for each field it desires to make editable. These may include the transient fields.

      In a superclass of a class I'm interested in, I call getClass ().getMethods ().

      This gets me all the (public?) Methods defined on the object, even those defined in a subclass (as desired).


      But getClass().getFields() does not return all the fields. It returns only those fields that have been marked public.


      I'd like to filter the get<field> and set<field> Method objects based on the presence/absence of the transient keyword associated with the field The field may be marked private, protected, or unmarked (package). I thought I might try applying the "transient" keyword to the methods that access the transient fields, but the compiler complains "Only variables can be transient."

      So, I can't filter the Method objects I'm getting based on the presence of the transient keyword on the field they set/get.
      company - ATAC , email - ###@###.###
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: