Time |
S |
Nick |
Message |
00:13 |
|
SoniEx2 |
I need null checks for instanceof right? |
00:15 |
|
sfisque |
yah because null has not type |
00:15 |
|
sfisque |
**no type |
00:16 |
|
SoniEx2 |
I thought it had all the types? |
00:16 |
|
sfisque |
well it has Object type, which is basically anything other than a primitive |
00:16 |
|
sfisque |
which means instanceof is useless for null |
00:16 |
|
sfisque |
so yes, you need to null gate |
00:17 |
|
sfisque |
or allow a NPE and require the user of the method to catch it |
00:18 |
|
sfisque |
the same way .equals() generally blows up if you send in null |
00:18 |
|
sfisque |
or most constructors |
00:23 |
|
SoniEx2 |
can I access other instances' private fields from an instance? |
00:27 |
|
sfisque |
2 ways. override the jvm security or via mutator method |
00:29 |
|
sfisque |
i guess 3 ways |
00:30 |
|
sfisque |
well no. 2 ways. i was going to say a java.lang.relect.Proxy, but i believe Proxy obeys the private/protected rules. |
00:30 |
|
sfisque |
*** .reflect. |
00:30 |
|
SoniEx2 |
so I can't do like class MyClass { private int x = 0; public MyClass() {} public MyClass(MyClass c){print(c.x)} }? |
00:30 |
|
SoniEx2 |
uhh I missed a ; |
00:32 |
|
sfisque |
i believe a class can access another instances (of the same class) attributes. most .equals methods work this way. it's one of the loopholes of java |
00:32 |
|
sfisque |
iirc |
00:33 |
|
sfisque |
testing that theory now |
00:33 |
|
sfisque |
well not theory, belief based on memory |
00:33 |
|
SoniEx2 |
if that's the case then it makes things a lot simpler and I can throw away my getCratePile method |
00:36 |
|
sfisque |
yah i'm looking at the boilerplate .equals() methods generated in JPA entity beans by NB, and they directly access the attributes of the "other" bean as well as "this" |
00:36 |
|
sfisque |
so inside a class, you can access the attributes of "same class" instances |
00:36 |
|
sfisque |
so there's a loophole |
00:36 |
|
sfisque |
for you |
00:36 |
|
sfisque |
afk for a bit |
03:09 |
|
|
sess joined ##javaee |
04:18 |
|
aspire |
SoniEx2 you can do that |
04:19 |
|
|
aspire_ joined ##javaee |
04:19 |
|
|
aspire joined ##javaee |
07:40 |
|
|
huhlig__ joined ##javaee |
08:13 |
|
|
lbevanda joined ##javaee |
08:16 |
|
lbevanda |
hello, can anyone help me with basic maven JavaEE (EAR) and why I can't call @Named beans in JSF (WAR) from my EJB project? |
09:52 |
|
|
AlexCzar joined ##javaee |
10:38 |
|
|
neuro_sys joined ##javaee |
14:50 |
|
|
aspire joined ##javaee |
15:18 |
|
|
aspire joined ##javaee |
18:23 |
|
sfisque |
for the logger if he comes back: ibevanda that is an anti pattern. your war packaged beans should be calling "into" the ejb layer, not the other way round. if your ejb layer is calling "up" into the web layer, you need to redesign |
18:24 |
|
pdurbin |
sfisque: can't I just add "@Named" to anything I want to autocomplete in Netbeans on the JSF side? |
18:25 |
|
sfisque |
yes. the only difference between cdi and jsf managed is jsf managed has viewscoped integraged and cdi you have to explicitly manage conversationscoped |
18:26 |
|
sfisque |
but ibevanda was talkinga bout calling from the ejb layer up to the web layer. which is, well… broken |
18:27 |
|
sfisque |
if you're calling from an ejb to a @named bean, you need to refactor or leave this industry |
18:27 |
|
pdurbin |
:) |
21:03 |
|
|
neuro_sy1 joined ##javaee |
21:21 |
|
|
aspire_ joined ##javaee |
22:44 |
|
|
aspire_ joined ##javaee |
23:36 |
|
|
aspire joined ##javaee |