All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.ao.schema.CachingTableNameConverter Maven / Gradle / Ivy

Go to download

This is the full Active Objects library, if you don't know which one to use, you probably want this one.

There is a newer version: 6.1.1
Show newest version
package net.java.ao.schema;

import com.google.common.base.Function;
import com.google.common.collect.MapMaker;
import net.java.ao.RawEntity;

import java.util.Map;

import static com.google.common.base.Preconditions.*;

/**
 * 

A table name converter that simply caches the converted table names.

*

This implementation uses a {@link java.util.concurrent.ConcurrentMap} and is thread safe.

* * @since 0.9 */ public final class CachingTableNameConverter implements TableNameConverter { private final Map>, String> cache; public CachingTableNameConverter(final TableNameConverter delegateTableNameConverter) { checkNotNull(delegateTableNameConverter); this.cache = new MapMaker().makeComputingMap(new Function>, String>() { public String apply(Class> entityClass) { return delegateTableNameConverter.getName(entityClass); } }); } public String getName(Class> entityClass) { return cache.get(entityClass); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy