dev@glassfish.java.net

Re: Example of support for --target option?

From: Tim Quinn <tim.quinn_at_oracle.com>
Date: Thu, 3 Jun 2010 15:40:02 -0500

On Jun 3, 2010, at 3:31 PM, Byron Nevins wrote:

> Marina,
>
> Your wish is my command -- checkin attached
>
> Note: I'm thinking of changing isCluster and isServer as follows.
> Comments? Useful?
Avoid returning anything but boolean from methods named "isSomething."

Also, will most callers of these methods actually care which type of
target a value is? If they care, then shouldn't they use getCluster
or getServer (or whatever is the equivalent)? If they don't care then
wouldn't they use getReferenceContainers and not need to ask which
type?

- Tim

>
> Cluster isCluster() --> returns null if this is not a cluster
> otherwise it returns the same object "cast" to a Cluster
>
> Server isServer() --> returns null if this is not a Server otherwise
> it returns the same object "cast" to a Server
>
> ============
> Then instead of:
>
> if(rc.isCluster())
> Cluster clu = (Cluster) rc; // guaranteed safe cast
> else if(rc.isServer())
> Server serv = (Server) rc;
>
> ------------
>
> Cluster clu = rc.isCluster();
> Server serv = rc.isServer();
>
> if(clu != null)
> etc...
>
>
> On 6/3/2010 12:37 PM, Marina Vatkina wrote:
>> Can you send a pointer to Byron's checkin?
>>
>> thanks,
>> -marina
>
> <Attached
> Message
> .eml
> >---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net




Tim Quinn | GlassFish | +1.847.604.9475
Oracle Software Development
Lake Forest, IL