grails - Groovy: Are two variables referring to the same object? -


I am debugging some Groove code for a website and raising an issue where I have a object A In a portion of the flow, a variable set in the controller and inside it (read it back and its correct).

Then I understand the same object in a different controller. But the variable is no longer set

Either my assumption is that the first controller has object A same as object A as the other controller has been raised Or something has been modified in the value of N-route

So, can there be a very basic question (and I feel terrible that this is something basic about the work of my Groove / Java Indicates misunderstanding - so please be gentle): how can I tell EA if in object A is the same as controller 1 then in object a in controller 2 (by that I mean the same thing It is not that they are equivalent).

I raise what I thought was the same object in a different controller.

An example of what you are doing in the controller and what you are doing in the second controller will help clarify what is going on. It is not clear what you can say "pick" in the quoted sentence above.

If you can organize such things as you have 2 references, then you will be o1 .is (o2) at the same time that will tell you if O1 indicates the same object as o2 . For some debug help you can use, which is in the first controller, you can call System.identityHashCode (o1) and in the second controller you can enter System.identityHashCode (o2) and see if they return the same value.

There is a web app in such a situation where the perception of being an object is unclear. For example, if you have 2 different proxies but they are proxying the same example, then there are references where you will treat them as a single object. Another example is that if you are working with continuous entities then you can have two different examples in memory, which are actually analogous to the same record in the data store.

However, the identity hashcode approach is a technique mentioned above that you can know whether these objects are the same object or not. If he does not do this for you and you can show some code or provide some more details which can help.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -