use of com.google.api.server.spi.config.ApiTransformer in project endpoints-java by cloudendpoints.
the class Serializers method getSerializerClasses.
public static List<Class<? extends Transformer<?, ?>>> getSerializerClasses(TypeToken<?> type, @Nullable final ApiSerializationConfig config) {
if (type == null) {
return Collections.emptyList();
}
List<Class<? extends Transformer<?, ?>>> allParentSerializers = Lists.newArrayList();
List<TypeToken<?>> serializedTypes = Lists.newArrayList();
for (TypeToken<?> typeToken : type.getTypes()) {
ApiTransformer apiSerialization = typeToken.getRawType().getAnnotation(ApiTransformer.class);
if (isSupertypeOf(typeToken, serializedTypes)) {
continue;
}
if (apiSerialization != null) {
allParentSerializers.add(apiSerialization.value());
serializedTypes.add(typeToken);
} else if (config != null) {
ApiSerializationConfig.SerializerConfig serializerConfig = config.getSerializerConfig(typeToken);
if (serializerConfig != null) {
allParentSerializers.add(serializerConfig.getSerializer());
serializedTypes.add(typeToken);
}
}
}
return allParentSerializers;
}
Aggregations