Seguinte, desculpe-me, mas, não tentendi o que vc quiz dizer. Fiz
alguns teste de descobri o seguinte:
quando tenho um atributo na minha classe java do tipo String consigo
acessa-lo tanto faz se ele é public ou private, porém quando tenho um
atributo do tipo Filhos(um classe criada por mim) so consigo acessar
se a minha instancia de filhos for public....

Alguém sabe me explicar porque???
Segue abaixo classes envolvidas na questão:

Usuário:
package test.pojo;
public class Usuario {
        private int id;
        private String nome;
        private String sobreNome;
        private Filhos filhos;  // se aqui for public funciona.... estou
achando muito estranho

        public Usuario(int id, String nome, String sobreNome) {
                this.setId(id);
                this.setNome(nome);
                this.setSobreNome(sobreNome);
                this.setFilhos("Agata", "Heitor");
        }

        public String teste() {
                return "Deu certo";
        }

        public Integer getId() {
                return this.id;
        }
        public void setId(Integer id) {
                this.id = id;
        }
        public String getNome() {
                return this.nome;
        }
        public void setNome(String nome) {
                this.nome = nome;
        }
        public String getSobreNome() {
                return this.sobreNome;
        }
        public void setSobreNome(String sobreNome) {
                this.sobreNome = sobreNome;
        }

        public void setFilhos(String filho1, String filho2) {
                this.filhos = new Filhos(filho1, filho2);
        }

        public Filhos getFilhos() {
                return this.filhos;
        }
}

Filhos:
package test.pojo;
public class Filhos {
        private String filho1;
        private String filho2;

        public Filhos(String filho1, String filho2) {
                setFilho1(filho1);
                setFilho2(filho2);
        }

        public String getFilho1() {
                return this.filho1;
        }
        public void setFilho1(String filho1) {
                this.filho1 = filho1;
        }
        public String getFilho2() {
                return this.filho2;
        }
        public void setFilho2(String filho2) {
                this.filho2 = filho2;
        }
}

Flex:
<?xml version="1.0" encoding="utf-8"?>

<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml";
    xmlns="*"
    xmlns:cs="test.granite.components.*"
    xmlns:et="test.granite.ejb3.entity.*"
    layout="vertical">

    <mx:Script>
        <![CDATA[
                import mx.messaging.Producer;
                import
mx.charts.effects.effectClasses.SeriesInterpolateInstance;

            import mx.controls.Alert;
            import mx.rpc.events.ResultEvent;
            private function onRetornaUsuario(event:ResultEvent):void{
                var usuario:Object = Object(event.result);
                mx.controls.Alert.show("Eu, "+usuario.nome+'
'+usuario.sobreNome+", tenho 2 filhos: "+usuario.filhos.filho1+" e
"+usuario.filhos.filho2);
                }
        ]]>
    </mx:Script>

    <mx:RemoteObject id="srvHelloWorld"
        showBusyCursor="true"
        destination="HelloWorldService"
        result="onRetornaUsuario(event)" />
    <mx:Button label="Pega Usuário"
click="srvHelloWorld.retornaUsuario()"/>

</mx:Application>


Desde já, Obrigado.



On 14 jul, 15:46, "Silvio Luiz" <[EMAIL PROTECTED]> wrote:
> A chamada que você faz no flex é via o nome do atributo, mas pra que ele
> acesse o valor do mesmo na sua classe, é necessário existir  um getter pra
> recuperar o valor...Mesmo que o atributo seja público você não consegue
> acessar seu valor no flex sem o getter.
>
> Att,
>
> Silvio Luiz
>
> On 7/14/07, Ronaldo Agra <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > Pra essa pergunta eu não tenho resposta... mas se vc descobrir nos
> > avisa... =D
>
> > On 7/14/07, Aranha <[EMAIL PROTECTED] > wrote:
>
> > > Tinha acabado de chegar a esta comclusão.... mas eu não posso chamar
> > > um metodo da minha classe? e se eu estiver usando encapsulamento? deve
> > > ter um geito de executar um metodo do Objeto ja recebido...
>
> > > Desde já, Obrigado.
>
> > > Sandro Mueller
>
> > > On 14 jul, 13:16, "Ronaldo Agra" < [EMAIL PROTECTED]> wrote:
> > > > Você deve acessar o atributo pelo nome, não pelo GET, ou seja:
>
> > > > private function onRetornaUsuario( event:ResultEvent ) : void{
> > > >     var usuario:Object = Object( event.result );
> > > >     mx.controls.Alert.show( usuario.nome );
>
> > > > }
>
> > > > []'s
> > > > Ronaldo.
>
> > > > On 7/14/07, Ricardo Ramires < [EMAIL PROTECTED]> wrote:
>
> > > > > Tente testar pelo debug adicionando um breakpoint na ultima linha
> > > > > desse metodo ou de um trace
>
> > > > > private function onRetornaUsuario(event:ResultEvent):void{
> > > > >     trace(event.result);
> > > > > }
>
> > > > > se retornar o objeto tente copiar ele
>
> > > > > var usuario:Object =  ObjectUtil.copy(event.result);
>
> > > > > É uma tentativa
>
> > > > > ;-)
>
> > > > > On 14 jul, 11:15, Aranha <[EMAIL PROTECTED]> wrote:
> > > > > > Bom Dia,
>
> > > > > > como faço para manipular quando recebo uma classe Usuario.java
> > > (desrita
> > > > > > abaixo) recebida pelo GranitDS, abaixo segue logicas usadas na
> > > > > > tentativa bem como o erro recebido:
>
> > > > > > logica do result:
> > > > > > private function onRetornaUsuario(event:ResultEvent):void{
> > > > > >      var usuario:Object = Object(event.result);
> > > > > >      mx.controls.Alert.show(usuario.getNome());
>
> > > > > > }
>
> > > > > > Classe usuario no java:
> > > > > > package test.pojo;
> > > > > > public class Usuario {
> > > > > >         private int id;
> > > > > >         public String nome;
> > > > > >         private String sobreNome;
>
> > > > > >         public Usuario(int id, String nome, String sobreNome) {
> > > > > >                 setId(id);
> > > > > >                 setNome(nome);
> > > > > >                 setSobreNome(sobreNome);
> > > > > >         }
>
> > > > > >         public Integer getId() {
> > > > > >                 return id;
> > > > > >         }
> > > > > >         public void setId(Integer id) {
> > > > > >                 this.id = id;
> > > > > >         }
> > > > > >         public String getNome() {
> > > > > >                 return nome;
> > > > > >         }
> > > > > >         public void setNome(String nome) {
> > > > > >                 this.nome = nome;
> > > > > >         }
> > > > > >         public String getSobreNome() {
> > > > > >                 return sobreNome;
> > > > > >         }
> > > > > >         public void setSobreNome(String sobreNome) {
> > > > > >                 this.sobreNome = sobreNome;
> > > > > >         }
>
> > > > > > }
>
> > > > > > Erro recebido:
> > > > > > TypeError: Error #1010: A term is undefined and has no properties.
>
> > > > > >         at
> > > > > mx.utils::ObjectProxy/http://www.adobe.com/2006/actionscript/flash/
> > > > > > proxy::callProperty()
> > > > > >         at Counter/::onRetornaUsuario()
> > > > > >         at Counter/__srvHelloWorld_result()
> > > > > >         at flash.events::EventDispatcher/
> > > > > > flash.events:EventDispatcher::dispatchEventFunction()
> > > > > >         at flash.events::EventDispatcher/dispatchEvent()
> > > > > >         at mx.rpc::AbstractService/dispatchEvent()
> > > > > >         at mx.rpc.remoting.mxml::RemoteObject/dispatchEvent()
> > > > > >         at
> > > mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/
> > > > > > internal::dispatchRpcEvent()
> > > > > >         at
> > > mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/
> > > > > > internal::resultHandler()
> > > > > >         at mx.rpc::Responder/result()
> > > > > >         at mx.rpc::AsyncRequest/acknowledge ()
> > > > > >         at ::NetConnectionMessageResponder/NetConnectionChannel.as
> > > > > > $40:NetConnectionMessageResponder::resultHandler()
> > > > > >         at mx.messaging::MessageResponder/result ()
>
> > > > > > se alguem poder me ajudar...
>
> > > > > > Desde já, Obrigado.
> > > > > > Sandro Mueller- Ocultar texto entre aspas -
>
> > > > - Mostrar texto entre aspas -
>
> --
> Silvio Luiz- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -


--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para [EMAIL PROTECTED]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a