Getting static member from Field

Hello,
I have a 'static type safe enum class' and I want to use reflection to implement its toString() method, the String returned should be the name of the field.
(Note that the static instance variables themselves do not have String fields that could be used for the toString() return value.)
I am able to iterate through all fields of the class and print out the names using getName()
But not sure how to compare the types of the fields to a particular type. For example:
for (int i = 0; i < fields.length; i++)
Field field = fields;
// how to compare a field to know if it is a
// particular static instance field
if (field.getType().equals(MyEnum.A_STATIC_INSTANCE))
return field.getName();

for (int i = 0; i < fields.length; i++)
    Field field = fields;
Object fieldValue = field.get(null);
if (fieldValue == this) return field.getName();
throw new IllegalStateException();Note that &#91;code] tags produce the pretty formatting in this post.

Similar Messages

  • Getting hyperlink formula from field objects.

    Hi everyone,
    I'm looking to extend the export to .pdf functionality in order to include hyperlinks. I have already ran some proof of concept programs, and I'm able to export to .pdf and add a hyperlink to a rectangular area of an existing .pdf document. The only thing left is to be able to pull the information regarding field location, size and hyperlink from the report.
    So, that's my question; How do I loop through the fields of an existing crystal report, check for hyperlink formula field, then get the link text/field position and size?
    I know that I'm asking for a lot here... I don't need full code samples, just some hints where to start... for example:
    - Where do I find the collection of generated data field objects?
    - Where do I find the hyperlink text on those objects?
    Thanks, in advance, for any help that you may be able to offer.
    - Scott

    Hi Scott,
    The first place I go is to the .NET Object browser. You have to add all of the CR Assemblies to get all of the info but it's a great place to start:
    Just search on "hyperlink" and you get this first hit and a few more:
    CrystalDecisions.CrystalReports.ViewerObjectModel.ReportObjectInstance.HyperLink
    CrystalDecisions.Windows.Forms.ObjectInfo.Hyperlink
    CrystalDecisions.ReportAppServer.ReportDefModel.ISCRObjectFormat.HyperlinkText
    CrystalDecisions.ReportAppServer.ReportDefModel.ISCRObjectFormat.HyperlinkType
    Here's what I typically include in my projects for testing:
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using CrystalDecisions.ReportAppServer.ClientDoc;
    using CrystalDecisions.ReportAppServer.Controllers;
    using CrystalDecisions.ReportAppServer.ReportDefModel;
    using CrystalDecisions.ReportAppServer.CommonControls;
    using CrystalDecisions.ReportAppServer.CommLayer;
    using CrystalDecisions.ReportAppServer.CommonObjectModel;
    using CrystalDecisions.ReportAppServer.ObjectFactory;
    using CrystalDecisions.ReportAppServer.DataSetConversion;
    using CrystalDecisions.ReportAppServer.DataDefModel;
    using CrystalDecisions.ReportSource;
    using CrystalDecisions.Windows.Forms;
    Then go to help.sap.com and get the latest SDK Help files. Or if you are using VS 2010 then use the local install of it.
    Thank you
    Don

  • How to invoke a non-static member from a static reference?

    Hello JDC
    My program consist of several classes. I find it more readable,logic and useful to declare all the methods in all the classes �static� and get access by Class.member().
    The problem showed up when I must use a java biuld-in method( as Component.remove ) within my static method , then I receive compile error.
    The first alternative is to create the class instance inside the static my static method , the second is to use interface which declare its member as static final. The two ways doesn�t fit to my needs , do anyone know another way?
    Thanks in advance
    Shay

    Hi
    im sorry but im not sure what you mean by "OO desgin". i'll appreciate if you'll link me some sources about this , its sound very interesting .
    It may be that you are moving to Java from COBOL or >FOTRAN or something and you are not comfortable with >OO philosophy
    For example, you can never have two instances of >the same class have different properties. What's the >point of having classes at all if you are going to do it >this way? Java is my first language , you sound very unhappy about the way i ignore the OOP , i think you right in some terms but i need to exam my thinking again and think how can i implements the same ideas in a form of OOP. whenever all those information will come i'll be able to response.
    thanks for your reply
    Shay Gaghe

  • Get Parent node from Base member

    Hi ,
    My user select base member from CV .
    I want parent node for that base member .
    I am using =EVPRO( App name , memmber id , "PARENTH1" ) .
    I am not getting parent member from this funcation .
    Pls let me know any other way for this ?
    regards,
    PSR

    Hi,
    EVPRO for getting the value for PARENTH1 of any member should work. Please check whether you have included all the parameters of this function inside double quotes.
    EVPRO("APPNAME","MEMBER_ID","PROPERTY")
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Frequent static electricity from my iPhone 6

    I kept getting static electricity from my iPhone 6, just holding it on its own (ie not whilst charging the battery) as I type my texts or browsing the Internet. It hasn't got a casing on. Is this normal? It's happening quite frequently, and it's quite disturbing.

    HI
    I contacted Apple & did as below as advised & I got my contacts back.
    Before I started I made sure that I had  a Icloud backup for my IPhone ( which was before the problem started ).[ Settings > ICloud > Backup. ]
    IPhone reset - by 'Erase all contents & settings...
    after the phone starts, choose to restore from Icloud backup.. & choose the Backup you think is without the issue.
    VERY IMPORTANT.. Once the phone restores from the backup & the Home screen comes, put the phone in Airplane mode Immediately.
    Now go to settings > Icloud > put the contacts OFF. ( Keep the contacts )
    Now OFF the Airplane mode & go to settings > Icloud > put the contacts ON & select Merge.
    I got all my contacts back which was there until that Backup.
    Thanks again  - Apple support.

  • How to Get static attributes dynamically

    Hi,
    I have to get static attributes from the context dynamically is it possible?
      DATA node     TYPE REF TO if_wd_context_node.
      DATA element  TYPE REF TO if_wd_context_element.
      node = wd_context->path_get_node( path = path_node ).
      element = node->get_element( ).
      element->set_static_attributes( static_attributes = ??? ).
    Thank you in advance.
    Miguel

    Hi ,
    i would suggest to use CL_ABAP_STRUCTDESCR
    cl_abap_typedescr=>describe_by_data

  • HFR - Getting the value from a member prompt to render in a report

    I have need to see the value or values selected from an HFR report prompt on the report once the report renders.
    The prompt value is desired to be placed in the Header of the report but ultimately as long we can see the prompt value rendered/placed any where on the report that will be good.
    Is there a function or other means to capture the selected dimension value stemming from a prompt selection?
    The more complex piece to this questions is that the row member where the prompt resides is using an advanced member selection which takes the value of the member prompt AND the Lev0 list of members to display on the report. Doing the level 0 "AND" of the advanced member selection removes any chance of getting the original prompt value select.
    If any one has any ideas or tried and true techniques, please share.
    Thanks in advance.
    Cheers,
    Christian
    http://www.artofbi.com

    Hi Christian
    It sounds like you are familiar with the text functions that can get you member names / aliases from cells.
    Have you thought about retrieving the member from the prompt and then simply hiding the column/row,
    e.g. in column A select 'Prompt for Dim'
    in column B select 'Descendants of Same Member as Col A' AND 'Level 0 Dim'
    hide column A
    use the text function to get you the name/alias from column A
    Hope this helps
    Stuart

  • HT5624 Why in my email ( the one on my ipod5 that I use with my apple ID) when I get emails about my use of my apple ID to use a service in the from field it has my fathers name and when I click on it it shows his contact info ????

    Why in my email ( the one on my ipod5 that I use with my apple ID) when I get emails about my use of my apple ID to use a service in the from field it has my fathers name and when I click on it it shows his contact info ???? I also set up my apple ID with a new email account and also I signed up for iCloud but used the same apple I'd email and password but it gave me a I cloud email! I did activate the favorites in my email . Noticed the from field has my fathers name and contact and it is a notification about me using my apple ID to sign in to FaceTime! Something is messed up, not sure how or why???

    i didn't read a lot of your 2nd paragraph, but it seems like the password is the issue, right?
    do a true clean install
    reboot your machine and hold down command+option+r, you should see a spinning globe - if you don't see the globe or anything that reads internet recovery, shut down and try again
    at menu, chose disk utility and once there, find your HD on the left side, select the physical name and erase it as mac journaled
    exit disk utlity
    at menu, choose install OSX
    this time, when it asks for a password just hit continue, it will let you complete without a password
    you should be able to get into your laptop, now figure out what password you'll be able to use with your kb issue

  • When I send a Group message from my address book, the entire group gets listed in the "To" line. How do I get each member to receive the message individually without listing all members? Its just messy is all.

    When I send a Group message from my address book, the entire group gets listed in the "To" line. How do I get each member to receive the message individually without listing all members? Its just messy is all. Any help is greatly appreciated.

    Hey Grupo Castillo,
    Thanks for the question. You can actually configure this behavior from Mail preferences:
    1. Choose Preferences from the Mail menu.
    2. Click Composing.
    3. Deselect the checkbox for "When sending to a group, show all member addresses".
    When you send an email to the group, only the groups name will be seen.
    Mac OS X: Mail - How to Hide Address Book Group Member Names When Sending an Email
    http://support.apple.com/kb/TA21082
    Thanks,
    Matt M.

  • Trying to access server remotely. Have Static IP from ISP but if I type that address into browser I get router login page. How do I get RDP

    Hi Guys, Please help.  I am trying to run remote desktop from internet.  I have just been given a static IP address from my ISP and when I type it into browser I get router login page.  I want to be able to use Remote Desktop.  I can
    use RDP on the LAN and works great but not from external (internet).  I don't know how to get static IP address to open windows login page or RDP to connect when I put IP address into RDP..  I have Windows 2003 server running. 

    Check your router for free ports. You may use http port number "80" to port forward the request to your server. In your firewall settings, create a new rule to allow incoming http request. Before that enable NAT in your router for LAN and assign
    a static IP address for the server machine. It would make port forwarding easier.

  • How to get my Name in the From Field instead of email address?

    For an Exchange Activesync account, how do you get your friendly "Name" to show in the From: field rather than email address ([email protected])?
    I seem to be able to do this fro IMAP/POP accounts but not Exchange Activesync.
    All the discussions I've found about gmail and Activesync seem to be centered on getting your messages to show a different return email address than your exchange account. I'm not looking for this, just to show the Name.
    Thanks

    If you add a contact ("Contacts app>> "+">> enter info) with that email address, it will appear in mail with whatever name you set in the email address' contact.

  • How do I get a value from a portal form for a non database field ? HELP!!

    I have a form based off of a table that I added a field to. The form is to allow the user to change abbreviation for a
    department field ie. BIO to BIOL. for a biology department. I have a pl/sql procedure for validation using the custom option
    on the update button to verify the user and update the data. I have tested to code at the sql prompt and it works.
    They only difference between the prompt and the form is the non-database field new_dept_abbr was added to the
    form. I don't know how to capture the value of the user input into a variable that can be used in the pl/sql.
    Any help would be appreciated.
    I have tried this approach
    v_new_dept_abbr := p_session.get_value_as_varchar2(
    p_block_name => 'default',
    p_attribute_name => 'new_dept_abbr'
    have tried using p_attribute_name as 'a_new_dept_abbr' but this does work and does not exist in the body of the form.
    Have also tried setting the p_block_name to _session - still doesn't work.
    Any ideas??
    Thanks
    Debbie Brennan

    Thanks for the info. I tried that and it still doesn't pull the value. I have opened a TAR via metalink, but I'm not getting any
    satisfactory answers. I ran across an note - 137172.1 that has this snippet of information in it.
    Unfortunately, at this time (portal 3.0.7.6.2) , a non-table item cannot be
    referenced in a plsql event handler, only in client side JavaScript code. This
    is a known limitation and will be fixed in a future release.
    I don't know how to get the value from the client side JavaScript code to a pl/sql variable. Do you?
    I've been trying to get them to tell me if the 'known issue' has been addressed in 3.0.9.
    I'll keep at it. Thanks so much for your suggestion I appreciate it.
    Deb

  • Change mail "from" field when share a document get stuck into account selection

    Hi All,
    When I use an application and I try to share a document by mail e popup window appears. Now if I try to change the "from" (I have two mail accounts configured on iOS) the current window is replaced with the list of all available "sender" mail addresses, but, from here, it's impossible to get back to the "share by mail" window!
    See the images in sequence:
    Step 1. Share a doc
    Step 2. Tap on "From" field:
    Step 3. Change "sender" and get stuck
    At this point I can only kill the application!
    This doesn't happens when the share by mail window is as big as the iPad screen!

    Back up all data.
    Triple-click the line below to select it:
    ~/Library/Application Support/AddressBook/MailRecents-v4.abcdmr
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A folder should open with an item selected. Quit the application if it's running. Move the selected item to the Desktop, leaving the window open. Relaunch the application and test. If there's no change, quit again and put the item you moved back where it was, overwriting the one that may have been created in its place. Otherwise, delete the item you moved.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Getting an image from a DVD/Quicktime member

    Has anyone worked out how to grab a frame still from a DVD or Quicktime member (from within Director, directly or otherwise)
    I need to do this on both PC and Mac, but the mac one is more important to me at the moment.
    When I try and access the image property of such a member (DVD/Quicktime) it says 3 parameters wanted, which i guess is its way of saying 'no can do'
    DVD is hard wired DTS so I'm guessing its just not possible from within director. Does anyone know of a command line utility that could output an image from a DVD?
    QT - ???

    As you've noted, it's not possible with a DVD from within Director.
    With a QuickTime file you can open a MIAW, place a sprite on-stage whose member.directToStage = 0 and grab window.image. You don't need to explicitly open() the window to get its image, or you can open it but somewhere offscreen - assuming you need to do this at runtime and don't want your suers to see this happening.

  • Only get static when attempting to play music from Apple TV

    I only get static when attempting to play music on Apple TV from the cloud.  Any thoughts?
    Vin

    iTunes Match is available now. You can sign up from your computer and then, on your Apple TV, you can turn iTunes Match on to listen to your iCloud library from the Apple TV.

Maybe you are looking for