MessageFieldUtil { public static boolean isMessage(Field field) { return field.getType() instanceof Message; } private  MessageFieldUtil(); static String getFieldType(Field field); static String getFieldName(Field field); static String getJsonFieldName(Field field); static String getFieldGetterName(Field field); static String getFieldSetterName(Field field); static String getFieldWitherName(Field field); static String getEnumFieldValueGetterName(Field field); static String getEnumFieldValueSetterName(Field field); static String getFieldCleanerName(Field field); static boolean isMessage(Field field); static String getHasMethodName(Field field); static String getBuilderSetterName(Field field); static String getDefaultValue(Field field); static boolean isScalarNullableType(Field field); static String getRepeatedFieldType(Field field); static String getIterableFieldType(Field field); static String getWrapperFieldType(Field field); static String getRepeatedFieldGetterName(Field field); static String getRepeatedEnumFieldValueGetterName(Field field); static String javaRepeatedEnumValueGetterByIndexName(Field field); static String getRepeatedEnumConverterName(Field field); static String getRepeatedFieldSetterName(Field field); static String getRepeatedEnumValueSetterName(Field field); static String repeatedGetCountMethodName(Field field); static String repeatedGetByIndexMethodName(Field field); static String getRepeatedBuilderSetterName(Field field); static String getBuilderGetterName(Field field); static String getRepeatedFieldAdderName(Field field); static String getRepeatedFieldAddAllName(Field field); static String getRepeatedEnumValueAdderName(Field field); static String getRepeatedEnumValueAddAllName(Field field); static String toStringPart(Field field); static String protostuffReadMethod(Field field); static String protostuffWriteMethod(Field field); static String bitFieldName(Field field); static int bitFieldIndex(Field field); static int bitFieldMask(Field field); static String getMapFieldType(Field field); static String getMapFieldKeyType(Field field); static String getMapFieldValueType(Field field); static String getMapGetterName(Field field); static String getMapSetterName(Field field); static String mapGetByKeyMethodName(Field field); static String getMapFieldAdderName(Field field); static String getMapFieldAddAllName(Field field); static String javaOneofConstantName(Field field); static boolean isNumericType(Field field); static boolean isBooleanType(Field field);  }
@Test void isMessage_scalar() { Field field = new Field(null); field.setType(ScalarFieldType.INT32); assertFalse(MessageFieldUtil.isMessage(field)); }
@Test void isMessage_message() { Proto proto = new Proto(); proto.setPackage(new Package(proto, "package")); Message message = new Message(proto); message.setName("Message"); message.setProto(proto); Field field = new Field(null); field.setType(message); assertTrue(MessageFieldUtil.isMessage(field)); }
@Test void isMessage_enum() { Proto proto = new Proto(); proto.setPackage(new Package(proto, "package")); Enum anEnum = new Enum(proto); anEnum.setName("Enum"); anEnum.setProto(proto); Field field = new Field(null); field.setType(anEnum); assertFalse(MessageFieldUtil.isMessage(field)); }