merge from 0.8.1

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1104054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sylvain Lebresne 2011-05-17 08:37:17 +00:00
parent f4f1781a8f
commit 259f06eff5
1 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,9 @@ package org.apache.cassandra.db.marshal;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import org.apache.cassandra.config.ConfigurationException;
public class ReversedType<T> extends AbstractType<T>
{
@ -30,6 +33,14 @@ public class ReversedType<T> extends AbstractType<T>
// package protected for unit tests sake
final AbstractType<T> baseType;
public static <T> ReversedType<T> getInstance(TypeParser parser) throws ConfigurationException
{
List<AbstractType> types = parser.getTypeParameters();
if (types.size() != 1)
throw new ConfigurationException("ReversedType takes exactly one argument, " + types.size() + " given");
return getInstance(types.get(0));
}
public static synchronized <T> ReversedType<T> getInstance(AbstractType<T> baseType)
{
ReversedType type = instances.get(baseType);