Java Interview Guide: How to Build Confidence With a Solid Understanding of Core Java Principles pdfdrive com



Yüklə 0,53 Mb.
Pdf görüntüsü
səhifə37/47
tarix06.05.2023
ölçüsü0,53 Mb.
#108601
1   ...   33   34   35   36   37   38   39   40   ...   47
Java Interview Guide

Inheritance Proxies
An object that is non-final can be proxied by another class that extends it.
For example, in order to log every method call on an ArrayList, you could
create a ProxyList class that extends ArrayList and overrides every
method with a delegated call to super(). Each overridden method provides
a join point that can be surrounded by logging code.
This proxy could be passed to any method that accepts a List or an
ArrayList
. However, one limitation of inheritance proxies is that final classes
and final methods cannot be proxied.


Runtime Weaving vs Binary Weaving
Weaving is the process of linking aspects and objects together. Proxy objects are
examples of runtime weaving, which can be accomplished through pure coding
patterns. Binary weaving injects aspects directly into bytecode. Binary weaving
can take place at compile-time with a custom compiler or at load-time with
a custom class loader. Binary weaving has none of the limitations of interface
or inheritance proxies, but it usually requires the help of a dedicated library.


AspectJ
AspectJ is a widely used AOP framework with support for compile-time
weaving, load-time weaving, and post-compile weaving for external classes.
AspectJ is often used in conjunction with the Spring framework, which provides
additional support for aspects as well as runtime weaving.


Questions
What is the difference between a core concern and a cross-cutting concern?
What is aspect-oriented programming?
What is the difference between an interface proxy and an inheritance proxy?
What is the difference between runtime weaving and binary weaving?
What is the AspectJ library?



Yüklə 0,53 Mb.

Dostları ilə paylaş:
1   ...   33   34   35   36   37   38   39   40   ...   47




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin