Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:10:02+00:00 2026-06-09T14:10:02+00:00

Another newbie issue. I have a situation where I have to assign a value

  • 0

Another newbie issue. I have a situation where I have to assign a value to domain class property in groovy.

The code is

cf.”$it.key” = it.value

the property type for cf.”$it.key” can be Integer, Long or String – but it.value is always a String. I have seen that when cf.”$it.key” is Integer or Long, groovy converts it.value to ascii value( for example if it.value is “6”, cf.”$it.key” becomes 54, when it is “7”, it becomes 55 and so on). As of now, I have resolved the issue by introducing check methods as shown below. But was wondering if there is a better solution to the problem.

              if (it.value.isInteger()){
                  cf."$it.key" = new Integer(it.value)
              }
              else if (it.value.isLong()){
                  cf."$it.key" = new Long(it.value)
              }

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:10:04+00:00Added an answer on June 9, 2026 at 2:10 pm

    Assuming you’re iterating through a map,you should be able to use bindData, i.e.

    bindData( cf, map )
    

    Make sure you read that section of the docs though, as there are security implications

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Another newbie question. The goal: each ingredient can have zero or more unit conversions
I have another newbie Python question. I have the following piece of code that
another newbie-question regarding rails and bootstrap. I am using something like this: <div class=tabbable
another iPhone newbie question... I have the following: NSPersistentStoreCoordinator NSManagedObjectContext NSManagedObjectModel Is it possible
Rails newbie here. I have a list of items which can have a status
Another newbie question from me. Just checking whether my code below is possible. I.e
Just another Rails newbie with a problem. I have some Javascript (dynamic) in a
Hello friends a newbie question... The Issue is like this: I have a static
Another newbie question: In the following code, what if the thread is preempted after
Another .net newbie question I created a class that inherits System.Web.UI.Page with the intention

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.