Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.java.ao.schema;
 
 
 import static com.google.common.base.Preconditions.checkNotNull;

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

This implementation uses a com.google.common.cache.LoadingCache and is thread safe.

Since:
0.9
    private final LoadingCache<Class<? extends RawEntity<?>>, Stringcache;
    public CachingTableNameConverter(final TableNameConverter delegateTableNameConverter)
    {
        checkNotNull(delegateTableNameConverter);
        this. = CacheBuilder.newBuilder().build(new CacheLoader<Class<? extends RawEntity<?>>, String>()
        {
            @Override
            public String load(final Class<? extends RawEntity<?>> keythrows Exception
            {
                return delegateTableNameConverter.getName(key);
            }
        });
    }
    public String getName(Class<? extends RawEntity<?>> entityClass)
    {
        return .getUnchecked(entityClass);
    }
New to GrepCode? Check out our FAQ X