Implementing Array-Valued Annotations in Java
In Java, annotations provide a structured way to attach metadata to code elements such as classes, methods, and fields. While many annotations use simple scalar types, you can also define attributes that accept arrays, allowing you to associate multiple values with a single annotation instance.
Defining Array Attributes
To support multiple valu ...
Posted on Sun, 20 Sep 2026 16:38:45 +0000 by REDFOXES06
Generic Servlet Dispatcher Using Reflection for Method Routing
public class GenericServletDispatcher extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
...
Posted on Wed, 16 Sep 2026 16:11:10 +0000 by northk
Understanding Annotations in Java
Annotations in Java, introduced in JDK 1.5, serve as a form of metadata, providing declarative information about code elements. Unlike comments, which are for human readers, annotations are intended for the Java compiler or runtime environment.
Annotations can be applied to packages, classes, fields, methods, and parameters, offering insights o ...
Posted on Fri, 11 Sep 2026 16:04:07 +0000 by Jakehh
Implementing Deep and Shallow Cloning in C#
Reflection-Based Cloning Implementation
This approach uses reflection to create deep clones of objects:
public abstract class CloneableBase : ICloneable
{
public object Clone()
{
object cloneInstance = Activator.CreateInstance(GetType());
FieldInfo[] cloneFields = cloneInstance.GetType().GetFields();
int ...
Posted on Sat, 29 Aug 2026 16:32:34 +0000 by davidska
Mastering Java Reflection: Runtime Class Inspection and Manipulation
Core Principles of Reflection
Java's reflection API enables dynamic examination and modification of class structures during program execution. This capability allows applications to interact with classes whose definitions are unknown at compile time, forming the backbone of many modern frameworks and dynamic systems.
Obtaining Class Metadata
Ev ...
Posted on Sun, 23 Aug 2026 16:18:10 +0000 by krispykreme
Implementing the Builder Design Pattern in C#
Classic Implementation
Definision
The Builder Pattern decouples the construction of a complex object from its representation, allowing the same construction process to create different representations.
Pattern Structure
Abstract Builder (Builder): Defines an abstract interface for creating parts of a Product object. It specifies what needs to ...
Posted on Wed, 19 Aug 2026 16:44:28 +0000 by m@tt
Advanced Java Code Obfuscation Techniques
During a recent code review session, I was struck by the diverse approaches to writing code in our team. It became clear that maintaining consistent coding standards remains an ongoing challenge.
Today, let's explore some advanced Java techniques that can make your code perplexing to colleagues. Mastering these techniques will give your code an ...
Posted on Mon, 17 Aug 2026 16:26:08 +0000 by cosmicsea
Day 3 Part 1: Dish Management (AOP, Custom Annotations, Reflection, File Upload)
The automatic filling of common fields primarily uses AOP (Aspect-Oriented Programming), involving reflection mechanisms and custom annotations. For adding new dishes, we learn about file upload techniques using Alibaba Cloud OSS for cloud storage, along with handling relationships between two tables—retrieving dish IDs from the dish_flavor tab ...
Posted on Sun, 09 Aug 2026 16:04:58 +0000 by tzuriel
Understanding AS3 Reflection: getDefinitionByName, getQualifiedClassName, and getQualifiedSuperclassName
The flash.utils package provides several reflection methods that allow developers to inspect class information at runtime. These utilities can transform string class paths into actual class references and retrieve metadata about object hierarchies.
getDefinitionByName
This function converts a fully-qualified class name string into an actual cla ...
Posted on Sun, 02 Aug 2026 16:40:51 +0000 by aboyd
Understanding Java Reflection Through Practical Examples
Java reflection is a powerful feature that enables inspection and manipulation of classes, methods, fields, and constructors at runtime—even when their names are not known at compile time. This capability allows programs to examine or "reflect upon" themselves, and manipulate intenral properties of classes.
Consider this analogy: imag ...
Posted on Thu, 30 Jul 2026 16:10:40 +0000 by Vivid Lust