Results 1 to 4 of 4
  1. #1
    Nirmitha is offline Member
    Join Date
    Sep 2013
    Posts
    3
    Rep Power
    0

    Default Java Reflection API

    Hi ,

    I have doubt regarding when to use Java reflection API , In our project we got a requirement to validate user inputs at serve side ( we do validation at client side also) . To do validation at server side , we can add validation for the request at controller side . But I heard a suggestion saying we can use Java reflection api , Where we interpret each request and do validation over there , If success we continue to go to controller and continue .
    But I feel Java reflection API should be used for run time installations and validations , Which are done only once when the app is "UP" . But here for validations at server side we have to use it every time .IS that "OK" .Are there back draws .Kindly reply with all possible Positives and negatives in this approach..

    Regards,
    Nirrmitaw

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Java Reflection API

    Reflection definitely CAN be used, but there is a performance drawback, and you would still, most likely, need detailed information about how the things are to be validated. Better would be to include validation classes on the server based on the object class being passed with which you can then perform the validation quickly and easily using a table lookup to find the validator and then passing that validator the object that was passed.

  3. #3
    Nirmitha is offline Member
    Join Date
    Sep 2013
    Posts
    3
    Rep Power
    0

    Default Re: Java Reflection API

    Hi ,
    you mean to say write the validation classes for the each type of objects you are sending from front-end to back end . Are you speaking about form validations. Can you explain it briefly

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Java Reflection API

    Seeing as how you didn't mention anything about browsers and web sites, I assumed (along with everything that goes along with that) that you are using a stand-alone client and a self-written server. If you are using an enterprise server and a browser client, then study JSF. It includes validators.

Similar Threads

  1. Help - Reflection API
    By joshendy in forum New To Java
    Replies: 1
    Last Post: 04-10-2012, 04:53 AM
  2. Reflection
    By minama in forum Advanced Java
    Replies: 7
    Last Post: 01-09-2012, 07:42 PM
  3. how to use java.reflection with parameter(s)
    By newbiejava in forum New To Java
    Replies: 8
    Last Post: 08-25-2010, 10:21 AM
  4. Java reflection: find serializable classes in package
    By andrew222 in forum Advanced Java
    Replies: 2
    Last Post: 02-27-2010, 08:36 AM
  5. Array Reflection: Multi Array Reflection
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-23-2008, 09:08 PM

Posting Permissions

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