Class Validator
Validates the configuration of objects.
Inheritance
Namespace: BlueprintCore.Utils
Assembly: BlueprintCore.dll
Syntax
public class Validator
Remarks
Any API implemented in BlueprintCore calls this for all relevant object types. If you instantiate objects outside of BlueprintCore you can call Check(Object) to get validation warnings.
Constructors
| Improve this Doc View SourceValidator(String, String)
Creates a Validator for an object. The name and type name are used to generate the error string.
Declaration
public Validator(string name, string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.String | typeName |
Methods
| Improve this Doc View SourceCheck(Object)
Validates the given object
Declaration
public void Check(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Remarks
Uses a combination of Wrath validation logic and custom logic validating that implicit object constraints are met. The exact validation run varies by type.
- Kingmaker.ElementsSystem.Element typesVerifies that Kingmaker.ElementsSystem.Element.name is set.
- Kingmaker.Blueprints.BlueprintComponent typesKingmaker.Blueprints.BlueprintComponent.ApplyValidation(Owlcat.QA.Validation.ValidationContext, System.Int32)
- Owlcat.QA.Validation.IValidated typesOwlcat.QA.Validation.IValidated.Validate(Owlcat.QA.Validation.ValidationContext,System.Int32)
Note that you can call this method multiple time for a given Validator instance. All of the errors will be bundled into a single error string. This is useful when constructing a several related objects. For example, a single BlueprintConfigurator instance stores a single Validator which is used to validate all of its fields, components, actions, and conditions.
GetErrorString()
Returns a string listing each validation error on a separate line, or an empty string if there are no errors.
Declaration
public string GetErrorString()
Returns
Type | Description |
---|---|
System.String |
HasErrors()
Declaration
public bool HasErrors()
Returns
Type | Description |
---|---|
System.Boolean |