23.02.2017 Views

Java

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Java</strong> 275<br />

private final String apellido;<br />

public ConNombreYApellido(<br />

String nombre, String apellido) {<br />

super();<br />

this.nombre = nombre;<br />

this.apellido = apellido;<br />

}<br />

@Override<br />

public Object invoke(<br />

Object proxy,<br />

Method method,<br />

Object[] arguments)<br />

throws Throwable {<br />

String name = method.getName();<br />

if(name.equals(“nombre”)) {<br />

return nombre();<br />

}<br />

if(name.equals(“apellido”)) {<br />

return apellido();<br />

}<br />

return null;<br />

}<br />

public String nombre() {<br />

return nombre;<br />

}<br />

}<br />

public String apellido() {<br />

return apellido;<br />

}<br />

¿Y el ClassLoader? El ClassLoader lo obtendremos de la propia clase del<br />

test unitario que usaremos para probar esto.<br />

Debemos tener en cuenta de que toda clase conoce y tiene una<br />

referencia al ClassLoader que la cargó en forma original.<br />

www.FreeLibros.me<br />

www.redusers.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!