getProperty method

  1. @override
String? getProperty(
  1. String name
)
override

Retrieves the value associated with the given property name, or null if the property is not present in this source.

Subclasses must provide the concrete lookup behavior appropriate for the underlying _source type. For example:

  • A map-based source may return _source[name]
  • A file-based source may perform key normalization or parsing
  • An environment variable source may apply case or platform rules

Returning null indicates absence of a value and is used internally by containsProperty and external resolvers such as PropertySourcesPropertyResolver to determine whether a property exists.

Implementation

@override
String? getProperty(String name) {
  if (_nonOptionArgsPropertyName == name) {
    final args = getNonOptionArgs();
    return args.isEmpty ? null : StringUtils.collectionToCommaDelimitedString(args);
  }

  final optionValues = getOptionValues(name);
  return optionValues == null ? null : StringUtils.collectionToCommaDelimitedString(optionValues);
}