feat!: GetRequiredBehaviour/HierarchyObject methods added for cleaner null handling
This commit is contained in:
@@ -14,10 +14,10 @@ public class BehaviourControllerFactory
|
||||
T behaviourController = TypeFactory.Get<T>(args);
|
||||
|
||||
if (!hierarchyObject.Assign(behaviourController))
|
||||
throw AssignException.From(hierarchyObject, behaviourController);
|
||||
throw AssignFailedException.From(hierarchyObject, behaviourController);
|
||||
|
||||
if (!behaviourController.Assign(hierarchyObject))
|
||||
throw AssignException.From(behaviourController, hierarchyObject);
|
||||
throw AssignFailedException.From(behaviourController, hierarchyObject);
|
||||
|
||||
return behaviourController;
|
||||
}
|
||||
|
@@ -15,12 +15,12 @@ public class BehaviourFactory
|
||||
|
||||
stateEnable ??= TypeFactory.Get<StateEnable>();
|
||||
if (!stateEnable.Assign(behaviour))
|
||||
throw AssignException.From(stateEnable, behaviour);
|
||||
throw AssignFailedException.From(stateEnable, behaviour);
|
||||
|
||||
if (!behaviour.Assign(stateEnable))
|
||||
throw AssignException.From(behaviour, stateEnable);
|
||||
throw AssignFailedException.From(behaviour, stateEnable);
|
||||
if (!behaviour.Assign(hierarchyObject.BehaviourController))
|
||||
throw AssignException.From(behaviour, hierarchyObject.BehaviourController);
|
||||
throw AssignFailedException.From(behaviour, hierarchyObject.BehaviourController);
|
||||
|
||||
return behaviour;
|
||||
}
|
||||
|
@@ -23,14 +23,14 @@ public class HierarchyObjectFactory
|
||||
stateEnable ??= TypeFactory.Get<StateEnable>();
|
||||
|
||||
if (!behaviourController.Assign(hierarchyObject))
|
||||
throw AssignException.From(behaviourController, hierarchyObject);
|
||||
throw AssignFailedException.From(behaviourController, hierarchyObject);
|
||||
if (!stateEnable.Assign(hierarchyObject))
|
||||
throw AssignException.From(stateEnable, hierarchyObject);
|
||||
throw AssignFailedException.From(stateEnable, hierarchyObject);
|
||||
|
||||
if (!hierarchyObject.Assign(behaviourController))
|
||||
throw AssignException.From(hierarchyObject, behaviourController);
|
||||
throw AssignFailedException.From(hierarchyObject, behaviourController);
|
||||
if (!hierarchyObject.Assign(stateEnable))
|
||||
throw AssignException.From(hierarchyObject, stateEnable);
|
||||
throw AssignFailedException.From(hierarchyObject, stateEnable);
|
||||
|
||||
return hierarchyObject;
|
||||
}
|
||||
|
@@ -12,10 +12,10 @@ public class StateEnableFactory
|
||||
T stateEnable = TypeFactory.Get<T>(args);
|
||||
|
||||
if (!entity.Assign(stateEnable))
|
||||
throw AssignException.From(entity, stateEnable);
|
||||
throw AssignFailedException.From(entity, stateEnable);
|
||||
|
||||
if (!stateEnable.Assign(entity))
|
||||
throw AssignException.From(stateEnable, entity);
|
||||
throw AssignFailedException.From(stateEnable, entity);
|
||||
|
||||
return stateEnable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user