Class PropertiesFileDocProvider
java.lang.Object
com.inductiveautomation.ignition.common.script.hints.PropertiesFileDocProvider
- All Implemented Interfaces:
ScriptFunctionDocProvider
Default ScriptFunctionDocProvider implementation that relies on various annotations on methods and fields to look up
script documentation in properties files.
Properties files are required to follow a rigid format, following this pattern:
Note:
Each row should begin with the 'bundle prefix'; see JythonElement.docBundlePrefix()
and
getBundlePrefix
.
common-param.$paramName=This is a fallback parameter name that can be used in multiple methods. $someFunction.desc=This is a description of $someFunction. $someFunction.param.$someParam=This is a description $someParam. $someFunction.param.$someParam.type=A type override for $someParam. \ The supplied type will be passed toTypeDescriptor.lookupOrNull(String)
. $someFunction.param.$someParam.default=This is the default value for $someParam. \ If specified, the parameter is optional by default. $someFunction.param.$someParam.optional=A b boolean string literal to indicate optionality of $someParam, as \ evaluated byBoolean.parseBoolean(String)
$someFunction.param.$someParam.deprecated=This is a deprecation message for $someParam. $someFunction.param.$someParam.replacement=This is a suggested replacement for $someParam. $someFunction.deprecated=This is a deprecation message for $someFunction. $someFunction.replacement=This is a replacement suggestion for $someFunction. $someFunction.returns=This is a description of the return value. $someFunction.returns.type=This is a type override for the return value. \ The supplied type name will be accepted verbatim and not evaluated for correctness or looked up at all. $someFunction.throws.$SomeException=This is a description of why $SomeException would be thrown.
- See Also:
-
Field Summary
FieldsFields inherited from interface com.inductiveautomation.ignition.common.script.hints.ScriptFunctionDocProvider
NO_DOC_PROVIDER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
protected com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Parameter
buildParameter
(Method method, String parameterName, Class<?> declaredType, Boolean declaredOptional) getAnnotations
(Method method) By default, no Java annotations are exposed to scripting.protected String
getBundlePrefix
(AnnotatedElement element) protected com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Deprecation
getDeprecation
(String bundlePrefix, String name) protected String
getExceptionDescription
(Method method, String exceptionName) protected List<com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Method.ThrowsDetail>
getExceptions
(Method method) Returns the list of exceptions that the method explicitly throws, plus the list fromJythonThrows
, minus the list fromJythonThrows.ignored()
.protected String
com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Attribute
getFieldDescriptor
(String path, Field field) protected com.inductiveautomation.ignition.common.script.typing.TypeDescriptor
getFieldType
(Field field) protected String
protected String
com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Method
getMethodDescriptor
(String path, Method method) protected List<com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Parameter>
getParameters
(Method method) protected String
getReturnDocs
(Method method) protected com.inductiveautomation.ignition.common.script.typing.TypeDescriptor
getReturnType
(Method method) protected List<com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Parameter>
parametersFromKeywordArgs
(Method method) protected List<com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Parameter>
parametersFromScriptArgs
(Method method) protected boolean
shouldBeIgnored
(String path, Field field)
-
Field Details
-
IGNORED_EXCEPTIONS
-
-
Constructor Details
-
PropertiesFileDocProvider
public PropertiesFileDocProvider()
-
-
Method Details
-
getMethodDescriptor
@Nullable public com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Method getMethodDescriptor(String path, Method method) - Specified by:
getMethodDescriptor
in interfaceScriptFunctionDocProvider
- Parameters:
path
- The path this function is being added at, as given to theScriptManager
.method
- TheMethod
being added as a scripting function.- Returns:
- A descriptor for the method.
- See Also:
-
CompletionDescriptor.Method
TypeDescriptor
-
getMethodDescription
-
getParameters
-
parametersFromKeywordArgs
-
parametersFromScriptArgs
-
buildParameter
-
getReturnType
protected com.inductiveautomation.ignition.common.script.typing.TypeDescriptor getReturnType(Method method) -
getReturnDocs
-
getAnnotations
By default, no Java annotations are exposed to scripting. If you want to expose annotations, override this method. -
getExceptions
protected List<com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Method.ThrowsDetail> getExceptions(Method method) Returns the list of exceptions that the method explicitly throws, plus the list fromJythonThrows
, minus the list fromJythonThrows.ignored()
. -
getIgnoredExceptions
-
getExceptionDescription
-
getFieldDescriptor
public com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor.Attribute getFieldDescriptor(String path, Field field) - Specified by:
getFieldDescriptor
in interfaceScriptFunctionDocProvider
- Parameters:
path
- The path this field is being added at, as given to theScriptManager
.field
- TheField
being added as a scripting field.- Returns:
- A descriptor for the field.
- See Also:
-
CompletionDescriptor.Attribute
TypeDescriptor
-
shouldBeIgnored
-
getFieldDescription
-
getFieldValue
-
getFieldType
@Nonnull protected com.inductiveautomation.ignition.common.script.typing.TypeDescriptor getFieldType(Field field) -
getBundlePrefix
-
b10n
-
getDeprecation
-