public ThriftTypeReference getFieldThriftTypeReference(FieldMetadata fieldMetadata) { Boolean isRecursive = fieldMetadata.isRecursiveReference(); if (isRecursive == null) { throw new IllegalStateException( "Field normalization should have set a non-null value for isRecursiveReference"); } return getThriftTypeReference(fieldMetadata.getJavaType(), isRecursive ? Recursiveness.FORCED : Recursiveness.NOT_ALLOWED); }
/** * Verifies that the the fields all have a supported Java type and that all fields map to the * exact same ThriftType. */ protected final void verifyFieldType(short id, String name, Collection<FieldMetadata> fields, ThriftCatalog catalog) { boolean isSupportedType = true; for (FieldMetadata field : fields) { if (!catalog.isSupportedStructFieldType(field.getJavaType())) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' type '%s' is not a supported Java type", structName, name, id, TypeToken.of(field.getJavaType())); isSupportedType = false; // only report the error once break; } } // fields must have the same type if (isSupportedType) { Set<ThriftType> types = new HashSet<>(); for (FieldMetadata field : fields) { types.add(catalog.getThriftType(field.getJavaType())); } if (types.size() > 1) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' has multiple types: %s", structName, name, id, types); } } }
/** * Verifies that the the fields all have a supported Java type and that all fields map to the * exact same ThriftType. */ protected final void verifyFieldType(short id, String name, Collection<FieldMetadata> fields, ThriftCatalog catalog) { boolean isSupportedType = true; for (FieldMetadata field : fields) { if (!catalog.isSupportedStructFieldType(field.getJavaType())) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' type '%s' is not a supported Java type", structName, name, id, TypeToken.of(field.getJavaType())); isSupportedType = false; // only report the error once break; } } // fields must have the same type if (isSupportedType) { Set<ThriftTypeReference> types = new HashSet<>(); for (FieldMetadata field : fields) { types.add(catalog.getFieldThriftTypeReference(field)); } if (types.size() > 1) { metadataErrors.addError("Thrift class '%s' field '%s(%s)' has multiple types: %s", structName, name, id, types); } } }
name = fieldMetadata.getName(); requiredness = fieldMetadata.getRequiredness(); type = catalog.getThriftType(fieldMetadata.getJavaType()); parameterInjection.getName(), parameterInjection.getParameterIndex(), fieldMetadata.getJavaType() ));
requiredness = fieldMetadata.getRequiredness(); fieldType = fieldMetadata.getType(); thriftType = catalog.getThriftType(fieldMetadata.getJavaType()); parameterInjection.getName(), parameterInjection.getParameterIndex(), fieldMetadata.getJavaType() ); injections.add(thriftParameterInjection);
parameterInjection.getName(), parameterInjection.getParameterIndex(), fieldMetadata.getJavaType() ); injections.add(thriftParameterInjection);
parameterInjection.getName(), parameterInjection.getParameterIndex(), fieldMetadata.getJavaType() ));