/** The name of the create method for the resource one-of for the given field config */ public String getResourceOneofCreateMethod(ImportTypeTable typeTable, FieldConfig fieldConfig) { return getAndSaveResourceTypeName(typeTable, fieldConfig.getMessageFieldConfig()) + "." + publicMethodName(Name.from("from")); }
/** The name of the create method for the resource one-of for the given field config */ public String getResourceTypeParentParseMethod( ImportTypeTable typeTable, FieldConfig fieldConfig) { return getAndSaveResourceTypeFactoryName(typeTable, fieldConfig.getMessageFieldConfig()) + "." + publicMethodName(Name.from("parse")); }
/** The function name to set the given field. */ public String getFieldSetFunctionName(FeatureConfig featureConfig, FieldConfig fieldConfig) { FieldModel field = fieldConfig.getField(); if (featureConfig.useResourceNameProtoAccessor(fieldConfig)) { return getResourceNameFieldSetFunctionName(fieldConfig.getMessageFieldConfig()); } else { return getFieldSetFunctionName(field); } }
/** The function name to get the given field. */ public String getFieldGetFunctionName(FeatureConfig featureConfig, FieldConfig fieldConfig) { FieldModel field = fieldConfig.getField(); if (featureConfig.useResourceNameProtoAccessor(fieldConfig)) { return getResourceNameFieldGetFunctionName(fieldConfig.getMessageFieldConfig()); } else { return getFieldGetFunctionName(field); } }
private InitCodeLineView generateSimpleInitCodeLine( MethodContext context, InitCodeNode item, boolean isFirstItem) { SimpleInitCodeLineView.Builder surfaceLine = SimpleInitCodeLineView.newBuilder(); FieldConfig fieldConfig = item.getFieldConfig(); SurfaceNamer namer = context.getNamer(); ImportTypeTable typeTable = context.getTypeTable(); surfaceLine.lineType(InitCodeLineType.SimpleInitLine); if (context.getFeatureConfig().useResourceNameFormatOptionInSample(context, fieldConfig)) { if (!context.isFlattenedMethodContext()) { // In a non-flattened context, we always use the resource name type set on the message // instead of set on the flattened method fieldConfig = fieldConfig.getMessageFieldConfig(); } if (item.getType().isRepeated()) { surfaceLine.typeName(namer.getAndSaveResourceTypeName(typeTable, fieldConfig)); } else { surfaceLine.typeName(namer.getAndSaveElementResourceTypeName(typeTable, fieldConfig)); } } else { surfaceLine.typeName(typeTable.getAndSaveNicknameFor(item.getType())); } surfaceLine.identifier(getVariableName(context, item)); setInitValueAndComments(surfaceLine, context, item, isFirstItem); return surfaceLine.build(); }
fieldConfig = fieldConfig.getMessageFieldConfig();
namer.getResourceNameFieldSetFunctionName(fieldConfig.getMessageFieldConfig())); } else { fieldSetting.fieldSetFunction(