Results 1 to 2 of 2

Thread: java annotations - small prog

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    0

    Question java annotations - small prog

    i've got some test-prog to write using annotations, there are some guidelines how it has to look like, so here they are:

    i have to define @Bind annotation which used for chosen fields of a class let me add their values to a map behind the keys = variable names.

    The process of adding and getting values to/from the map has to find his place in another class called Binder.

    i'm new in java things so.....

    things i must follow:
    -----------------------

    public class Test {
    @Bind static double a;
    @Bind static double b;
    double static c;

    somwhere in a method:
    a = 7;
    b = 12;
    c = 1;

    in some method of a constructor:
    Binder bdr = new Binder(...)
    bdr.bind();

    somwhere else:
    Map<..> map = bdr.getMap();

    and using 'map' there should be a possibility to access the values of 'a' and 'b', but not the 'c'.

    It seems to be very easy, but not for me, not now... can anyone help me to do this so i can be able to work on other things like that... thx in advance!

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java annotations - small prog

    I'm not at all sure about this, but I think since "Annotations are interfaces" you can probably use the "instanceof" keyword to distinguish between Bound and non-Bound variables.

    hope it works
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width