[Java] Proxy mode
proxy pattern
Simply put: instead of accessing the real object, the proxy object can be used to provide additional functional operations to extend the function of the target object without modifying the original target object.
The main purpose of the proxy mode is to extend the capabilities of the target object, for example, you can add s ...
Added by harvillo on Mon, 07 Mar 2022 19:23:26 +0200
[design pattern] - Proxy Pattern
Proxy Pattern
1 Introduction: Agency mode is also called entrustment mode, which is a structural design mode.
2 Definition: provide a proxy for other objects to control access to this object.
3 usage scenarios: (1) do not want to directly access an object; (2) when it is impossible or difficult to access an object, it can be accessed indirec ...
Added by DJ Digital Gem on Thu, 03 Mar 2022 23:55:44 +0200
Javabase java reflection mechanism - dynamic agent - jdk dynamic agent (source code)
Javabase java reflection mechanism
Application of reflection: dynamic proxy
Dynamic agent overview
Principle of agent design pattern:
Wrap the object with a proxy object, and then replace the original object with the proxy object. Any call to the original object must be operated through the proxy object. The proxy object determines whethe ...
Added by billshackle on Fri, 18 Feb 2022 01:30:02 +0200
2 annotation reflection and dynamic proxy
1.2 annotation reflection and dynamic proxy
1.2.1 reflection
Reflective entry Java lang.Class Objects in daily development are divided into two types: basic type and reference type
Basic type, (8 fixed)
Integer: byte, short, int, long
Decimal: float, do ...
Added by ionik on Sun, 13 Feb 2022 14:42:04 +0200
Implementation and source code analysis of Java Dynamic agent
1: Implementation of static agent
Define interface
/**
* @description:
* A factory that processes mobile phones
* @date: 2022/2/12
* @author: linshujie
*/
public interface IPhoneFactory {
/**
* Customized design of mobile phone
* @param design
*/
void makePhoneDesign(String design);
}
/**
* @description:
* A fac ...
Added by sublevel4 on Sat, 12 Feb 2022 18:46:41 +0200
Dynamic agent summary, all you need to know is here, no nonsense!
preface
Interview question: talk about jdk dynamic agent, cglib difference, implementation principle, advantages and disadvantages, and how to call methods
come from: One and a half years of face-to-face experience sharing of social recruitment (including JD Didi, the headline of Alibaba meituan)
This article summarizes the knowledge po ...
Added by zleviticus on Wed, 09 Feb 2022 16:07:23 +0200
Java Dynamic agent -- principle explanation & source code analysis
Examples of using dynamic agents
When it comes to Java's dynamic agent, I believe many developers are very familiar with it. However, in order to better explain and analyze the principle and source code of dynamic agent, let's first understand the actual use examples of dynamic agent:
Now there is a scenario:
Star Michel has two skills, sing ...
Added by jsschmitt on Wed, 09 Feb 2022 05:57:03 +0200
Principles and examples of combination mode and agent mode (static agent and dynamic agent)
Combination mode
Basic introduction
Composite Pattern, also known as partial overall pattern, creates a tree structure of object groups and combines objects into a tree structure to represent the hierarchical relationship of "whole part".The combination mode combines objects according to the tree structure, which is used to represen ...
Added by cullouch on Thu, 03 Feb 2022 14:46:57 +0200
CGLIB Dynamic Proxy
Summary
CGLIB is a powerful and high performance code generation library. It is widely used in AOP frameworks (Spring, dynaop) to provide methods for intercepting operations. Hibernate, as a popular ORM framework, also uses CGLIB to proxy one-side (many-to-one and one-to-one) associations (another mechanism for delayed collection extractio ...
Added by LiLaaron on Thu, 09 Dec 2021 19:54:43 +0200
Agent mode of design mode (20)
1, Foreword
In some cases, a customer does not want or cannot directly access an object. At this time, it needs to find an intermediary to help complete a task. This intermediary is the proxy object. For example, you don't have to go to the railway station to buy train tickets. You can buy them through 12306 websit ...
Added by jowatkins on Tue, 30 Nov 2021 14:26:36 +0200