class InputValidator {

    public static void validateNodeType(Object... args) throws InvalidParameterException {
        if (args.length < 4) return;
        boolean isValid = false;
        String className = (String) args[0];
        String actionDescription = (String) args[1];
        NodeType nodeTypeToCheck = (NodeType) args[2];

        if (nodeTypeToCheck != null) {
            for (int i = 3; i < args.length; i++) {
                if (nodeTypeToCheck.equals(args[i])) {
                    isValid = true;
                }
            }
            if (!isValid) {
                ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition();
                String invalidPropertyName = "nodeType";
                messageDefinition.setMessageParameters(invalidPropertyName, null);
                throw new InvalidParameterException(messageDefinition,
                                                    className,
                                                    actionDescription,
                                                    invalidPropertyName,
                                                    nodeTypeToCheck.name());
            }
        }
    }

}