public static ThriftType struct(ThriftStructMetadata structMetadata) { return new ThriftType(structMetadata); }
public static ThriftType struct(ThriftStructMetadata structMetadata) { return new ThriftType(structMetadata); }
public static ThriftType enumType(ThriftEnumMetadata<?> enumMetadata) { checkNotNull(enumMetadata, "enumMetadata is null"); return new ThriftType(enumMetadata); }
public static ThriftType enumType(ThriftEnumMetadata<?> enumMetadata) { checkNotNull(enumMetadata, "enumMetadata is null"); return new ThriftType(enumMetadata); }
public ThriftType coerceTo(Type javaType) { if (javaType == this.javaType) { return this; } Preconditions.checkState( protocolType != ThriftProtocolType.STRUCT && protocolType != ThriftProtocolType.SET && protocolType != ThriftProtocolType.LIST && protocolType != ThriftProtocolType.MAP, "Coercion is not supported for %s", protocolType ); return new ThriftType(this, javaType); }
public ThriftType coerceTo(Type javaType) { if (javaType == this.javaType) { return this; } Preconditions.checkState( protocolType != ThriftProtocolType.STRUCT && protocolType != ThriftProtocolType.SET && protocolType != ThriftProtocolType.LIST && protocolType != ThriftProtocolType.MAP, "Coercion is not supported for %s", protocolType ); return new ThriftType(this, javaType); }
public static ThriftType array(ThriftType valueType) { checkNotNull(valueType, "valueType is null"); Class<?> javaType = ReflectionHelper.getArrayOfType(valueType.getJavaType()); return new ThriftType(ThriftProtocolType.LIST, javaType, null, valueType); }
public static ThriftType array(ThriftTypeReference valueTypeReference) { checkNotNull(valueTypeReference, "valueTypeReference is null"); Class<?> javaType = ReflectionHelper.getArrayOfType(valueTypeReference.getJavaType()); return new ThriftType(ThriftProtocolType.LIST, javaType, null, valueTypeReference); }
public static <E> ThriftType list(ThriftTypeReference valueTypeReference) { checkNotNull(valueTypeReference, "valueTypeReference is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<List<E>>(){} .where(new TypeParameter<E>(){}, (TypeToken<E>) TypeToken.of(valueTypeReference.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.LIST, javaType, null, valueTypeReference); }
public static <E> ThriftType list(ThriftType valueType) { checkNotNull(valueType, "valueType is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<List<E>>(){} .where(new TypeParameter<E>(){}, (TypeToken<E>) TypeToken.of(valueType.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.LIST, javaType, null, valueType); }
public static <E> ThriftType set(ThriftTypeReference valueTypeReference) { Preconditions.checkNotNull(valueTypeReference, "valueTypeReference is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<Set<E>>(){} .where(new TypeParameter<E>(){}, (TypeToken<E>) TypeToken.of(valueTypeReference.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.SET, javaType, null, valueTypeReference); }
public static <E> ThriftType set(ThriftType valueType) { Preconditions.checkNotNull(valueType, "valueType is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<Set<E>>(){} .where(new TypeParameter<E>(){}, (TypeToken<E>) TypeToken.of(valueType.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.SET, javaType, null, valueType); }
public static <K, V> ThriftType map(ThriftTypeReference keyTypeReference, ThriftTypeReference valueTypeReference) { checkNotNull(keyTypeReference, "keyTypeReference is null"); checkNotNull(valueTypeReference, "valueTypeReference is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<Map<K, V>>(){} .where(new TypeParameter<K>(){}, (TypeToken<K>) TypeToken.of(keyTypeReference.getJavaType())) .where(new TypeParameter<V>(){}, (TypeToken<V>) TypeToken.of(valueTypeReference.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.MAP, javaType, keyTypeReference, valueTypeReference); }
public static <K, V> ThriftType map(ThriftType keyType, ThriftType valueType) { checkNotNull(keyType, "keyType is null"); checkNotNull(valueType, "valueType is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<Map<K, V>>(){} .where(new TypeParameter<K>(){}, (TypeToken<K>) TypeToken.of(keyType.getJavaType())) .where(new TypeParameter<V>(){}, (TypeToken<V>) TypeToken.of(valueType.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.MAP, javaType, keyType, valueType); }