private List<RelDataType> toSql(List<RelDataType> types) { return Lists.transform( types, new com.google.common.base.Function<RelDataType, RelDataType>() { public RelDataType apply(RelDataType input) { if (input instanceof RelDataTypeFactoryImpl.JavaType && ((RelDataTypeFactoryImpl.JavaType) input).getJavaClass() == Object.class) { return typeFactory.createSqlType(SqlTypeName.ANY); } return typeFactory.toSql(input); } }); }
@Persist @SuppressWarnings("unused") private void beforeSerialization() { documentIds = Lists.transform( documents, new Function<Document, DocumentRefid>() { public DocumentRefid apply(Document document) { return new DocumentRefid(document.getId()); } }); // Remove score from attributes for serialization otherAttributesForSerialization = MapUtils.asHashMap(SimpleXmlWrappers.wrap(attributes)); otherAttributesForSerialization.remove(SCORE); if (otherAttributesForSerialization.isEmpty()) { otherAttributesForSerialization = null; } }
/** For JSON serialization only. */ @JsonProperty("documents") @SuppressWarnings("unused") private List<Integer> getDocumentIds() { return Lists.transform(documents, Document.DocumentToId.INSTANCE); }