Abstract Factory Design Pattern in Java
The abstract factory design pattern in Java is a creational pattern that creates families of related objects through one interface, without naming their concrete classes. The client picks one factory, such as "India checkout" or "PostgreSQL", and every object it gets from that factory is guaranteed to fit with the others.
Where a plain factory answers "which class should I create?", Abstract Factory answers "which set of classes belongs together?". Without it, code chooses each object separately, and sooner or later GST is calculated on an order printed in dollars. It is one of the creational design patterns.
1. What Is the Abstract Factory Design Pattern?
The GoF intent is: "Provide an interface for creating families of related or dependent objects without specifying their concrete classes."
A family is a group of objects that only make sense together: a tax rule and a currency format for one country, or a pagination syntax and a key strategy for one database. The pattern declares one interface with a create method per product, and writes one implementation of it per family.
The client receives a factory object, usually once at startup, and calls its methods whenever it needs a product. Because every product comes from the same factory, the family stays consistent. Switching to another family means passing a different factory; the client code does not change. In object-oriented terms, it applies "depend on abstractions" to a whole group of objects at once.
2. Key Components
| Component | Responsibility | In the Basic Example |
|---|---|---|
| Abstract Factory | Interface with one creation method per product | CheckoutKitFactory |
| Concrete Factory | Creates every product of one family | IndiaCheckoutKit, UsCheckoutKit |
| Abstract Product | Interface for one kind of product | TaxCalculator, PriceFormatter |
| Concrete Product | One family's implementation of a product | GstTax, DollarFormatter |
| Client | Uses only the abstract factory and abstract products | CheckoutService |
The client holds an abstract factory reference. It calls the factory's methods, gets back abstract products, and makes the products work together. Only the concrete factory knows the concrete classes.
3. When Is Abstract Factory Useful?
- Region-specific behaviour: an e-commerce store sells in several countries, and tax, currency and invoice layout must all follow the same country.
- Supporting several vendors: a product runs on PostgreSQL, MySQL or Oracle, and each needs its own SQL for paging and keys.
- Environment switching: the same service runs on AWS, Azure or a laptop, with storage and messaging that must come from the same platform.
4. UML Class Diagram
The diagram shows the Basic Example.
CheckoutServicedepends on three interfaces only (dashed "uses" arrows).CheckoutKitFactoryhas one creation method per abstract product.- Dashed lines with hollow triangles mean "implements": two concrete factories and two concrete products per product interface.
- The coloured
«create»arrows show the families:IndiaCheckoutKitcreates only India products, andUsCheckoutKitonly US products.
5. Step-by-Step Execution Flow
- At startup the application chooses a concrete factory, for example
new IndiaCheckoutKit(), from configuration. - It passes the factory to
CheckoutServiceas aCheckoutKitFactory. - The service calls
createTaxCalculator()and receives aGstTax, typed asTaxCalculator. - It calls
createPriceFormatter()on the same factory and receives aRupeeFormatter. - On each order, the service calculates the tax and formats the amounts. The two products agree because they came from one factory.
6. Real-World Use Cases
- E-commerce: per-country kits of tax rules, currency format, address validation and invoice template.
- Payments and banking: a provider kit that creates the matching payment client, refund client and webhook signature verifier for one provider.
- Notifications: a brand kit that creates email, SMS and push templates in the same tone and language.
- The JDK:
java.sql.Connectionbehaves like an abstract factory.createStatement(),prepareStatement()andcreateBlob()return interface types, and each JDBC driver supplies its own matching implementations. - Spring Boot: two
@Configurationclasses guarded by@Profile("aws")and@Profile("azure")each define a matching set of beans. Activating a profile swaps the whole family, which is the Abstract Factory idea applied through configuration.
7. Problem Without the Pattern
Here the tax and the currency are chosen by separate settings:
import java.math.BigDecimal;
import java.math.RoundingMode;
public class CheckoutWithoutAbstractFactory {
static BigDecimal addTax(String taxRegion, BigDecimal amount) {
if ("IN".equals(taxRegion)) {
return amount.multiply(new BigDecimal("1.18")); // GST 18%
} else if ("US".equals(taxRegion)) {
return amount.multiply(new BigDecimal("1.0725")); // example 7.25% sales tax
}
throw new IllegalArgumentException("Unknown tax region: " + taxRegion);
}
static String format(String currencyRegion, BigDecimal amount) {
BigDecimal rounded = amount.setScale(2, RoundingMode.HALF_UP);
if ("IN".equals(currencyRegion)) {
return "Rs. " + rounded;
} else if ("US".equals(currencyRegion)) {
return "$" + rounded;
}
throw new IllegalArgumentException("Unknown currency region: " + currencyRegion);
}
public static void main(String[] args) {
BigDecimal cart = new BigDecimal("1000.00");
System.out.println("India order: " + format("IN", addTax("IN", cart)));
// Two independent settings: nothing stops a mismatched pair
System.out.println("Buggy order: " + format("US", addTax("IN", cart)));
}
}
India order: Rs. 1180.00
Buggy order: $1180.00
- Inconsistent families: the second order adds Indian GST and prints dollars, and nothing catches it.
- Duplication: every method repeats the same
if ("IN") ... else if ("US")chain. - Poor maintainability: adding Germany means finding and editing every chain.
- Tight coupling: business code knows every regional rule.
8. Solution Using the Pattern
Group the related objects into a kit. One CheckoutKitFactory interface creates the tax calculator and the formatter, and one concrete factory per country creates both.
A mismatch is now impossible by construction: the service receives one factory, so it cannot combine GST with dollars. The country check happens once, when the factory is chosen. Adding Germany means one new factory and its products; CheckoutService stays untouched. Tests can pass a test kit.
9. Abstract Factory Design Pattern in Java: Code Examples
Each example is a single file that runs on Java 21 with java FileName.java.
Basic Example: Regional Checkout Kits
Problem: fix the mismatch from section 7 so that tax and currency always come from the same country.
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
public class CheckoutKitDemo {
// Abstract products
interface TaxCalculator {
BigDecimal tax(BigDecimal amount);
String label();
}
interface PriceFormatter {
String format(BigDecimal amount);
}
// India family
static final class GstTax implements TaxCalculator {
public BigDecimal tax(BigDecimal amount) { return amount.multiply(new BigDecimal("0.18")); }
public String label() { return "GST 18%"; }
}
static final class RupeeFormatter implements PriceFormatter {
public String format(BigDecimal amount) { return "Rs. " + amount.setScale(2, RoundingMode.HALF_UP); }
}
// US family
static final class UsSalesTax implements TaxCalculator {
public BigDecimal tax(BigDecimal amount) { return amount.multiply(new BigDecimal("0.0725")); }
public String label() { return "Sales tax 7.25%"; }
}
static final class DollarFormatter implements PriceFormatter {
public String format(BigDecimal amount) { return "$" + amount.setScale(2, RoundingMode.HALF_UP); }
}
// Abstract factory: one method per product in the family
interface CheckoutKitFactory {
TaxCalculator createTaxCalculator();
PriceFormatter createPriceFormatter();
}
// Concrete factories: each one creates a matching family
static final class IndiaCheckoutKit implements CheckoutKitFactory {
public TaxCalculator createTaxCalculator() { return new GstTax(); }
public PriceFormatter createPriceFormatter() { return new RupeeFormatter(); }
}
static final class UsCheckoutKit implements CheckoutKitFactory {
public TaxCalculator createTaxCalculator() { return new UsSalesTax(); }
public PriceFormatter createPriceFormatter() { return new DollarFormatter(); }
}
// Client: sees only the abstract factory and abstract products
static final class CheckoutService {
private final TaxCalculator taxCalculator;
private final PriceFormatter formatter;
CheckoutService(CheckoutKitFactory kit) {
this.taxCalculator = kit.createTaxCalculator(); // both objects come from the same family
this.formatter = kit.createPriceFormatter();
}
String summary(BigDecimal cart) {
BigDecimal tax = taxCalculator.tax(cart);
return "cart %s + %s %s = %s".formatted(formatter.format(cart), taxCalculator.label(),
formatter.format(tax), formatter.format(cart.add(tax)));
}
}
public static void main(String[] args) {
BigDecimal cart = new BigDecimal("1000.00");
for (CheckoutKitFactory kit : List.of(new IndiaCheckoutKit(), new UsCheckoutKit())) {
CheckoutService checkout = new CheckoutService(kit);
System.out.println(kit.getClass().getSimpleName() + ": " + checkout.summary(cart));
}
}
}
Important classes and methods
CheckoutKitFactoryis the abstract factory; its two methods are the family's products.IndiaCheckoutKitandUsCheckoutKitare concrete factories.CheckoutServicetakes one kit in its constructor, so both products always match.
Expected output
IndiaCheckoutKit: cart Rs. 1000.00 + GST 18% Rs. 180.00 = Rs. 1180.00
UsCheckoutKit: cart $1000.00 + Sales tax 7.25% $72.50 = $1072.50
How it runs
mainloops over the two kits.- Each
CheckoutServiceasks its kit for a tax calculator and a formatter. summary()computes 18% or 7.25% of 1000.00 and formats every amount in the kit's currency.
Practical Example: SQL Dialect Kits
Problem: one repository must generate correct SQL for PostgreSQL, MySQL and Oracle, chosen from the JDBC URL.
import java.util.Collections;
import java.util.List;
public class SqlDialectKitDemo {
// Abstract products
interface Paginator {
String paginate(String query, int offset, int limit);
}
interface InsertBuilder {
String insert(String table, List<String> columns);
}
static String placeholders(int count) {
return String.join(", ", Collections.nCopies(count, "?"));
}
// PostgreSQL family: keys from a sequence, LIMIT ... OFFSET paging
static final class PostgresPaginator implements Paginator {
public String paginate(String query, int offset, int limit) {
return query + " LIMIT " + limit + " OFFSET " + offset;
}
}
static final class PostgresInsertBuilder implements InsertBuilder {
public String insert(String table, List<String> columns) {
return "INSERT INTO " + table + " (id, " + String.join(", ", columns) + ") VALUES (nextval('"
+ table + "_seq'), " + placeholders(columns.size()) + ")";
}
}
// MySQL family: AUTO_INCREMENT key, so the id column is left out
static final class MySqlPaginator implements Paginator {
public String paginate(String query, int offset, int limit) {
return query + " LIMIT " + offset + ", " + limit;
}
}
static final class MySqlInsertBuilder implements InsertBuilder {
public String insert(String table, List<String> columns) {
return "INSERT INTO " + table + " (" + String.join(", ", columns) + ") VALUES ("
+ placeholders(columns.size()) + ")";
}
}
// Oracle 12c+ family: sequence.NEXTVAL keys, OFFSET ... FETCH paging
static final class OraclePaginator implements Paginator {
public String paginate(String query, int offset, int limit) {
return query + " OFFSET " + offset + " ROWS FETCH NEXT " + limit + " ROWS ONLY";
}
}
static final class OracleInsertBuilder implements InsertBuilder {
public String insert(String table, List<String> columns) {
return "INSERT INTO " + table + " (id, " + String.join(", ", columns) + ") VALUES ("
+ table + "_seq.NEXTVAL, " + placeholders(columns.size()) + ")";
}
}
// Abstract factory
interface SqlDialectFactory {
Paginator createPaginator();
InsertBuilder createInsertBuilder();
}
// Concrete factories
static final class PostgresDialect implements SqlDialectFactory {
public Paginator createPaginator() { return new PostgresPaginator(); }
public InsertBuilder createInsertBuilder() { return new PostgresInsertBuilder(); }
}
static final class MySqlDialect implements SqlDialectFactory {
public Paginator createPaginator() { return new MySqlPaginator(); }
public InsertBuilder createInsertBuilder() { return new MySqlInsertBuilder(); }
}
static final class OracleDialect implements SqlDialectFactory {
public Paginator createPaginator() { return new OraclePaginator(); }
public InsertBuilder createInsertBuilder() { return new OracleInsertBuilder(); }
}
// The whole family is chosen once, from configuration
static SqlDialectFactory dialectFor(String jdbcUrl) {
String vendor = jdbcUrl.split(":")[1]; // jdbc:<vendor>:...
return switch (vendor) {
case "postgresql" -> new PostgresDialect();
case "mysql" -> new MySqlDialect();
case "oracle" -> new OracleDialect();
default -> throw new IllegalArgumentException("Unsupported database: " + vendor);
};
}
// Client: written once, works with every dialect
static final class OrderRepository {
private final Paginator paginator;
private final InsertBuilder inserts;
OrderRepository(SqlDialectFactory dialect) {
this.paginator = dialect.createPaginator();
this.inserts = dialect.createInsertBuilder();
}
String insertOrderSql() {
return inserts.insert("orders", List.of("customer_id", "total"));
}
String pageSql(int page, int size) {
return paginator.paginate("SELECT * FROM orders ORDER BY id", page * size, size);
}
}
public static void main(String[] args) {
List<String> urls = List.of(
"jdbc:postgresql://db:5432/shop",
"jdbc:mysql://db:3306/shop",
"jdbc:oracle:thin:@db:1521/shop");
for (String url : urls) {
SqlDialectFactory dialect = dialectFor(url);
OrderRepository orders = new OrderRepository(dialect);
System.out.println("== " + dialect.getClass().getSimpleName());
System.out.println(orders.insertOrderSql());
System.out.println(orders.pageSql(2, 10));
}
}
}
Important classes and methods
PaginatorandInsertBuilderare the abstract products. Their implementations must match: a PostgreSQL insert relies on a sequence, a MySQL insert onAUTO_INCREMENT.dialectFor()reads the vendor from the URL and returns the whole family.OrderRepositoryis written once and contains no vendor checks.
Expected output
== PostgresDialect
INSERT INTO orders (id, customer_id, total) VALUES (nextval('orders_seq'), ?, ?)
SELECT * FROM orders ORDER BY id LIMIT 10 OFFSET 20
== MySqlDialect
INSERT INTO orders (customer_id, total) VALUES (?, ?)
SELECT * FROM orders ORDER BY id LIMIT 20, 10
== OracleDialect
INSERT INTO orders (id, customer_id, total) VALUES (orders_seq.NEXTVAL, ?, ?)
SELECT * FROM orders ORDER BY id OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY
How it runs
- For each URL,
dialectFor()picks a concrete factory. - The repository builds its paginator and insert builder from that factory.
- Page 2 with size 10 becomes offset 20, written in each vendor's syntax. The
OFFSET ... FETCHform needs Oracle 12c or later.
Real-World Enterprise Example: Multi-Cloud Kits
Problem: a document service runs on AWS, Azure or a developer laptop. Storage and events must come from the same platform, and uploads run in parallel.
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class CloudKitDemo {
record StoredFile(String location, int sizeBytes) { }
// Abstract products
interface BlobStorage {
StoredFile put(String key, byte[] content);
}
interface EventPublisher {
void publish(String topic, String message);
List<String> published();
}
// Shared, thread-safe in-memory behaviour; real code would call each cloud SDK
abstract static class InMemoryStorage implements BlobStorage {
private final Map<String, byte[]> files = new ConcurrentHashMap<>();
protected abstract String location(String key);
public StoredFile put(String key, byte[] content) {
files.put(key, content.clone());
return new StoredFile(location(key), content.length);
}
}
abstract static class RecordingPublisher implements EventPublisher {
private final Queue<String> messages = new ConcurrentLinkedQueue<>();
protected abstract String channel(String topic);
public void publish(String topic, String message) { messages.add(channel(topic) + " <- " + message); }
public List<String> published() { return List.copyOf(messages); }
}
// AWS family
static final class S3Storage extends InMemoryStorage {
private final String bucket;
S3Storage(String bucket) { this.bucket = bucket; }
protected String location(String key) { return "s3://" + bucket + "/" + key; }
}
static final class SnsPublisher extends RecordingPublisher {
protected String channel(String topic) { return "sns:" + topic; }
}
// Azure family
static final class AzureBlobStorage extends InMemoryStorage {
private final String account;
AzureBlobStorage(String account) { this.account = account; }
protected String location(String key) { return "https://" + account + ".blob.core.windows.net/docs/" + key; }
}
static final class ServiceBusPublisher extends RecordingPublisher {
protected String channel(String topic) { return "servicebus:" + topic; }
}
// Local development family
static final class LocalDiskStorage extends InMemoryStorage {
protected String location(String key) { return "file:/tmp/uploads/" + key; }
}
static final class InMemoryPublisher extends RecordingPublisher {
protected String channel(String topic) { return "memory:" + topic; }
}
// Abstract factory, sealed so only reviewed families exist
sealed interface CloudKit permits AwsKit, AzureKit, LocalKit {
BlobStorage storage();
EventPublisher events();
}
// Concrete factories: each builds its family once and hands out the same thread-safe instances
record AwsKit(BlobStorage storage, EventPublisher events) implements CloudKit {
static AwsKit create(String bucket) { return new AwsKit(new S3Storage(bucket), new SnsPublisher()); }
}
record AzureKit(BlobStorage storage, EventPublisher events) implements CloudKit {
static AzureKit create(String account) { return new AzureKit(new AzureBlobStorage(account), new ServiceBusPublisher()); }
}
record LocalKit(BlobStorage storage, EventPublisher events) implements CloudKit {
static LocalKit create() { return new LocalKit(new LocalDiskStorage(), new InMemoryPublisher()); }
}
enum CloudProvider { AWS, AZURE, LOCAL }
static CloudKit kitFor(CloudProvider provider) {
return switch (provider) {
case AWS -> AwsKit.create("invoices-prod");
case AZURE -> AzureKit.create("jbtinvoices");
case LOCAL -> LocalKit.create();
};
}
// Exhaustive pattern matching over the sealed hierarchy (Java 21): no default needed
static String describe(CloudKit kit) {
return switch (kit) {
case AwsKit aws -> "AWS (S3 + SNS)";
case AzureKit azure -> "Azure (Blob Storage + Service Bus)";
case LocalKit local -> "Local (disk + in-memory events)";
};
}
// Client: stores a document and announces it, without knowing the cloud
static final class DocumentService {
private final CloudKit kit;
DocumentService(CloudKit kit) { this.kit = kit; }
StoredFile upload(String name, byte[] content) {
StoredFile file = kit.storage().put(name, content);
kit.events().publish("document-uploaded", file.location() + " (" + file.sizeBytes() + " bytes)");
return file;
}
}
public static void main(String[] args) {
List<String> invoices = List.of("inv-001.pdf", "inv-002.pdf");
for (CloudProvider provider : CloudProvider.values()) {
CloudKit kit = kitFor(provider);
DocumentService documents = new DocumentService(kit);
try (ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor()) {
for (String name : invoices) {
pool.submit(() -> documents.upload(name, ("PDF " + name).getBytes(StandardCharsets.UTF_8)));
}
} // close() waits for every upload to finish
System.out.println("== " + describe(kit));
kit.events().published().stream().sorted().forEach(message -> System.out.println(" " + message)); // sorted: thread order varies
}
}
}
Important classes and methods
CloudKitis a sealed abstract factory, so only the three reviewed families can exist.- Each concrete factory is a record that builds its products once and returns the same instances on every call. The products are thread-safe, so sharing is safe.
describe()uses Java 21 pattern matching forswitch; it needs nodefaultbecause the hierarchy is sealed.- The cloud calls are simulated in memory so the program runs without accounts.
Expected output
== AWS (S3 + SNS)
sns:document-uploaded <- s3://invoices-prod/inv-001.pdf (15 bytes)
sns:document-uploaded <- s3://invoices-prod/inv-002.pdf (15 bytes)
== Azure (Blob Storage + Service Bus)
servicebus:document-uploaded <- https://jbtinvoices.blob.core.windows.net/docs/inv-001.pdf (15 bytes)
servicebus:document-uploaded <- https://jbtinvoices.blob.core.windows.net/docs/inv-002.pdf (15 bytes)
== Local (disk + in-memory events)
memory:document-uploaded <- file:/tmp/uploads/inv-001.pdf (15 bytes)
memory:document-uploaded <- file:/tmp/uploads/inv-002.pdf (15 bytes)
How it runs
- For each provider,
kitFor()builds the matching kit. - Two uploads run on virtual threads. Closing the executor waits for both.
- Each upload stores the file, then publishes an event on the same platform's channel.
- Messages are sorted before printing because thread order varies.
10. Best Practices and Common Mistakes
Best practices
- Choose the concrete factory once, at startup or in configuration, and inject it.
- Keep each family small: only products that truly must match.
- Stateless concrete factories can be shared singletons, for example as Spring beans.
- Thread safety: if a factory caches products, they must be immutable or thread-safe, as in the Enterprise Example.
Common mistakes
- Overengineering: using Abstract Factory when there is one family, or when the products do not depend on each other.
- Mixing factories by getting one product from one kit and another from a different kit.
- Type checks such as
instanceof GstTaxin the client. - Huge factory interfaces that every family must implement in full.
11. When to Use and When Not to Use
Use it when wrong combinations would be a real bug, when the set of families is expected to grow, or when a whole platform must be swappable for tests.
Avoid it when the products vary independently, when you have a single family, or when new kinds of product are added often, since each one changes every factory. A dependency injection profile may already cover simple cases.
12. Advantages and Disadvantages
Advantages
- Guaranteed consistency within a family.
- Loose coupling: clients see interfaces only.
- Easy family swap by changing one object.
- New families without touching clients (Open/Closed).
Disadvantages
- New product kinds are expensive: every factory must change.
- Many classes: families × products, plus factories.
- More indirection for readers new to the code.
13. Comparison with Similar Patterns
| Aspect | Abstract Factory | Factory Method | Builder |
|---|---|---|---|
| Creates | A family of related products | One product | One complex product |
| Mechanism | Composition: the client holds a factory object | Inheritance: a subclass overrides a method | Step-by-step calls, then build() |
| Variation point | Which family | Which single class | Which settings |
| Easy to add | A new family | A new product subclass | A new optional setting |
Choose Factory Method for one varying product, Abstract Factory when several products must vary together, and Builder when the difficulty is assembling one object. They combine: concrete factories often implement each creation method as a factory method, and are often singletons. Prototype is an alternative that clones preconfigured objects instead of subclassing factories.
14. Summary
- The abstract factory design pattern in Java creates families of related objects through one interface.
- Purpose: keep products consistent and hide their concrete classes.
- Components: Abstract Factory, Concrete Factory, Abstract Product, Concrete Product, Client.
- The client gets one factory and requests every product from it.
- Used for regional rules, database dialects, cloud platforms and Spring profiles.
- Benefits: consistency, loose coupling, easy family swaps.
- Cost: adding a new product kind touches every factory.
15. Java Design Pattern Interview Questions and Answers
Q1. You must add a ShippingCalculator to every family. What changes, and can a default method help?
The abstract factory gets a new createShippingCalculator() method, and every concrete factory must implement it. A Java default method avoids touching every class, but it gives all families the same fallback, which can silently break consistency. Leaving the method abstract is usually safer, because the compiler then lists every factory that needs updating.
Q2. How can an enum implement an abstract factory?
Each constant is one concrete factory. You get exactly one instance per family, thread-safe by design, and easy lookup with valueOf().
enum RegionKit implements CheckoutKitFactory {
INDIA {
public TaxCalculator createTaxCalculator() { return new GstTax(); }
public PriceFormatter createPriceFormatter() { return new RupeeFormatter(); }
},
US {
public TaxCalculator createTaxCalculator() { return new UsSalesTax(); }
public PriceFormatter createPriceFormatter() { return new DollarFormatter(); }
}
}Q3. How would you switch a whole family of beans in Spring Boot?
Put each family in its own @Configuration class and activate one with @Profile or @ConditionalOnProperty. Each configuration class acts as a concrete factory, and clients inject only the interfaces.
@Configuration
@Profile("aws")
class AwsCloudConfig {
@Bean BlobStorage storage() { return new S3Storage("invoices-prod"); }
@Bean EventPublisher events() { return new SnsPublisher(); }
}Q4. One family cannot support a product, for example a local setup with no message queue. What do you do?
Return a Null Object, such as a publisher that only logs, so clients need no special cases. Throwing UnsupportedOperationException pushes the problem onto every caller. If several families lack the product, the family is too wide: split the factory into smaller interfaces (Interface Segregation Principle).
Q5. How do you unit-test a service that depends on an abstract factory?
Create a test family: a small factory that returns fakes or stubs with fixed results, and pass it to the service's constructor. Because the service only knows the interfaces, no mocking framework or real infrastructure is needed, and assertions can inspect what the fakes recorded.